[io-layer] Remove threads.h, thread-private.h and wthreads.c
authorLudovic Henry <ludovic@xamarin.com>
Thu, 7 Jul 2016 17:44:03 +0000 (19:44 +0200)
committerLudovic Henry <ludovic@xamarin.com>
Thu, 4 Aug 2016 13:41:47 +0000 (15:41 +0200)
20 files changed:
mono/io-layer/Makefile.am
mono/io-layer/io.c
mono/io-layer/processes.c
mono/io-layer/thread-private.h [deleted file]
mono/io-layer/threads.h [deleted file]
mono/io-layer/uglify.h
mono/io-layer/wapi-private.h
mono/io-layer/wapi.c
mono/io-layer/wapi.h
mono/io-layer/wthreads.c [deleted file]
mono/metadata/appdomain.c
mono/metadata/attach.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/mini/aot-compiler.c
mono/mini/debugger-agent.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h

index 54e2dde02a1847550cdff9d4162ed58ef6e41630..0eb885e055e4a843868fbcc00a1f0600a99827a1 100644 (file)
@@ -27,7 +27,6 @@ OTHER_H = \
        semaphores.h    \
        sockets.h       \
        status.h        \
-       threads.h       \
        timefuncs.h     \
        types.h         \
        uglify.h        \
@@ -74,8 +73,6 @@ OTHER_SRC = \
        socket-private.h        \
        socket-wrappers.h       \
        status.h                \
-       threads.h               \
-       thread-private.h        \
        timefuncs.c             \
        timefuncs.h             \
        timefuncs-private.h     \
@@ -89,8 +86,7 @@ OTHER_SRC = \
        wapi_glob.c             \
        wapi.h                  \
        wapi-private.h          \
-       wapi.c          \
-       wthreads.c
+       wapi.c
 
 
 WINDOWS_H = \
index b01007e4cc05a8465980318694fe1397f7a2bc7b..3a275dc83513af2c1aedabb890fa8a763fc29d61 100644 (file)
@@ -40,7 +40,6 @@
 #include <mono/io-layer/wapi-private.h>
 #include <mono/io-layer/io-private.h>
 #include <mono/io-layer/timefuncs-private.h>
-#include <mono/io-layer/thread-private.h>
 #include <mono/io-layer/io-portability.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/strenc.h>
index af9fc5da8ce63966eda0b4846bb3a213d4cba666..654c43771ebd5b4ad8e3bb421b227e61cca5dba0 100644 (file)
@@ -96,7 +96,6 @@
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
 #include <mono/io-layer/process-private.h>
-#include <mono/io-layer/threads.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/w32handle.h>
 
+#define STILL_ACTIVE STATUS_PENDING
+
 /* The process' environment strings */
 #if defined(__APPLE__)
 #if defined (TARGET_OSX)
diff --git a/mono/io-layer/thread-private.h b/mono/io-layer/thread-private.h
deleted file mode 100644 (file)
index e9ff31e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * thread-private.h:  Private definitions for thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_THREAD_PRIVATE_H_
-#define _WAPI_THREAD_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-
-#include "wapi-private.h"
-
-void
-_wapi_thread_init (void);
-
-extern void _wapi_thread_cleanup (void);
-
-#endif /* _WAPI_THREAD_PRIVATE_H_ */
diff --git a/mono/io-layer/threads.h b/mono/io-layer/threads.h
deleted file mode 100644 (file)
index e84a63b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * threads.h:  Thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_THREADS_H_
-#define _WAPI_THREADS_H_
-
-#include <glib.h>
-
-#include <pthread.h>
-
-#include <mono/io-layer/io.h>
-#include <mono/io-layer/status.h>
-#include <mono/io-layer/processes.h>
-#include <mono/io-layer/access.h>
-
-G_BEGIN_DECLS
-
-#define STILL_ACTIVE STATUS_PENDING
-
-#define THREAD_ALL_ACCESS              (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
-
-typedef guint32 (*WapiThreadStart)(gpointer);
-
-typedef struct {
-       pthread_t id;
-       GPtrArray *owned_mutexes;
-       gint32 priority;
-} MonoW32HandleThread;
-
-G_END_DECLS
-#endif /* _WAPI_THREADS_H_ */
index aa847569cb898c8e9087a5b285955d7cf53e85ae..5176da07ea7f2aa98f284fbf665d6f7d1cd2d629 100644 (file)
@@ -50,7 +50,6 @@ typedef WapiSecurityAttributes SECURITY_ATTRIBUTES;
 typedef WapiSecurityAttributes *LPSECURITY_ATTRIBUTES;
 typedef WapiOverlapped *LPOVERLAPPED;
 typedef WapiOverlappedCB LPOVERLAPPED_COMPLETION_ROUTINE;
-typedef WapiThreadStart LPTHREAD_START_ROUTINE;
 typedef WapiFileTime FILETIME;
 typedef WapiFileTime *LPFILETIME;
 typedef WapiSystemTime SYSTEMTIME;
index 060135abf2a5b832e2ecc0dc42a38f4059013022..ee961002d9eec7152e3741e77299836cab989d14 100644 (file)
@@ -20,6 +20,9 @@
 
 #include <mono/utils/mono-os-mutex.h>
 
+/* There doesn't seem to be a defined symbol for this */
+#define _WAPI_THREAD_CURRENT (gpointer)0xFFFFFFFE
+
 extern gboolean _wapi_has_shut_down;
 
 typedef struct 
@@ -32,7 +35,6 @@ typedef struct
 #include <mono/io-layer/mutex-private.h>
 #include <mono/io-layer/semaphore-private.h>
 #include <mono/io-layer/socket-private.h>
-#include <mono/io-layer/thread-private.h>
 #include <mono/io-layer/process-private.h>
 #include <mono/utils/w32handle.h>
 
index da38a1449277bd25bdff7a73be0def6f9c335c90..a9f93692400dbc03c96557e20ef08fc86a7aa793 100644 (file)
@@ -1,9 +1,14 @@
 
 #include "wapi.h"
 
-#include "process-private.h"
-#include "thread-private.h"
+#include "event-private.h"
 #include "io-trace.h"
+#include "io.h"
+#include "mutex-private.h"
+#include "process-private.h"
+#include "semaphore-private.h"
+#include "shared.h"
+#include "socket-private.h"
 
 #include "mono/utils/mono-lazy-init.h"
 #include "mono/utils/w32handle.h"
@@ -16,7 +21,6 @@ wapi_init (void)
        _wapi_shm_semaphores_init ();
        _wapi_io_init ();
        _wapi_processes_init ();
-       _wapi_thread_init ();
        _wapi_semaphore_init ();
        _wapi_mutex_init ();
        _wapi_event_init ();
@@ -30,7 +34,6 @@ wapi_cleanup (void)
        _wapi_has_shut_down = TRUE;
 
        _wapi_error_cleanup ();
-       _wapi_thread_cleanup ();
        wapi_processes_cleanup ();
        _wapi_io_cleanup ();
 }
index e0d4d48c09fcefe7100e8629e3a538408f70b7aa..4e0a688063984ad671543a10f51a4bc2d27290c7 100644 (file)
@@ -25,7 +25,6 @@
 #include <mono/io-layer/semaphores.h>
 #include <mono/io-layer/sockets.h>
 #include <mono/io-layer/status.h>
-#include <mono/io-layer/threads.h>
 #include <mono/io-layer/timefuncs.h>
 #include <mono/io-layer/versioninfo.h>
 #include <mono/io-layer/wait.h>
diff --git a/mono/io-layer/wthreads.c b/mono/io-layer/wthreads.c
deleted file mode 100644 (file)
index 1ecb121..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * threads.c:  Thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Ximian, Inc.
- * Copyright 2003-2011 Novell, Inc (http://www.novell.com)
- * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <glib.h>
-#include <string.h>
-#include <pthread.h>
-#include <sched.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/thread-private.h>
-#include <mono/io-layer/mutex-private.h>
-#include <mono/io-layer/io-trace.h>
-
-#include <mono/utils/mono-threads.h>
-#include <mono/utils/atomic.h>
-#include <mono/utils/mono-time.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-void
-_wapi_thread_init (void)
-{
-}
-
-void
-_wapi_thread_cleanup (void)
-{
-}
index 3384a3c06a0c6b0531b0f1ffffdb81b6e74c87db..ae391b08948e86b49aa92aac222083d8e0214175 100644 (file)
@@ -2355,7 +2355,7 @@ deregister_reflection_info_roots (MonoDomain *domain)
        mono_domain_assemblies_unlock (domain);
 }
 
-static guint32 WINAPI
+static gsize WINAPI
 unload_thread_main (void *arg)
 {
        MonoError error;
@@ -2565,7 +2565,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        tp.priority = MONO_THREAD_PRIORITY_NORMAL;
        tp.stack_size = 0;
        tp.creation_flags = CREATE_SUSPENDED;
-       thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, &tp, &tid);
+       thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, &tp, &tid);
        if (thread_handle == NULL)
                return;
        mono_thread_info_resume (tid);
index 6b970ae9a24a22560c7b4a30dbc42864db735274..4372397aa5740f6fae868ffabf4ce2ce6bea96de 100644 (file)
@@ -102,7 +102,7 @@ static gboolean needs_to_start, started;
 
 static void transport_connect (void);
 
-static guint32 WINAPI receiver_thread (void *arg);
+static gsize WINAPI receiver_thread (void *arg);
 
 static void transport_start_receive (void);
 
@@ -489,7 +489,7 @@ transport_start_receive (void)
        g_assert (receiver_thread_handle);
 }
 
-static guint32 WINAPI
+static gsize WINAPI
 receiver_thread (void *arg)
 {
        MonoError error;
index f9b1c5f229c17a2716db780fd99a7c54d3bc8434..5b910191f6c4ff0adba5cc680d20d653d034cfb4 100644 (file)
@@ -48,7 +48,6 @@ typedef enum {
 
 #ifdef HOST_WIN32
 typedef SECURITY_ATTRIBUTES WapiSecurityAttributes;
-typedef LPTHREAD_START_ROUTINE WapiThreadStart;
 #endif
 
 typedef struct _MonoInternalThread MonoInternalThread;
index 567e7b466b3f37e69922508bcebcc7fab2c9d4d5..8ae79d05d99dfdc68bbe473398d18d8c9e377775 100644 (file)
@@ -805,7 +805,7 @@ static guint32 WINAPI start_wrapper_internal(void *data)
        return(0);
 }
 
-static guint32 WINAPI start_wrapper(void *data)
+static gsize WINAPI start_wrapper(void *data)
 {
        volatile int dummy;
 
@@ -870,7 +870,7 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star
        tp.stack_size = stack_size;
        tp.creation_flags = CREATE_SUSPENDED;
 
-       thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)start_wrapper, start_info, &tp, &tid);
+       thread_handle = mono_threads_create_thread (start_wrapper, start_info, &tp, &tid);
 
        if (thread_handle == NULL) {
                /* The thread couldn't be created, so set an exception */
index 2d821b32d745c27dd438dd9bd01771c2f4746493..dba952c9ff1763d8926082130c5f10e4827e0a0e 100644 (file)
@@ -7770,12 +7770,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        InterlockedIncrement (&acfg->stats.ccount);
 }
  
-static void
-compile_thread_main (gpointer *user_data)
+static gsize WINAPI
+compile_thread_main (gpointer user_data)
 {
-       MonoDomain *domain = (MonoDomain *)user_data [0];
-       MonoAotCompile *acfg = (MonoAotCompile *)user_data [1];
-       GPtrArray *methods = (GPtrArray *)user_data [2];
+       MonoDomain *domain = ((MonoDomain **)user_data) [0];
+       MonoAotCompile *acfg = ((MonoAotCompile **)user_data) [1];
+       GPtrArray *methods = ((GPtrArray **)user_data) [2];
        int i;
 
        MonoError error;
@@ -7785,6 +7785,8 @@ compile_thread_main (gpointer *user_data)
 
        for (i = 0; i < methods->len; ++i)
                compile_method (acfg, (MonoMethod *)g_ptr_array_index (methods, i));
+
+       return 0;
 }
 
 static void
@@ -9807,7 +9809,7 @@ compile_methods (MonoAotCompile *acfg)
                        tp.priority = MONO_THREAD_PRIORITY_NORMAL;
                        tp.stack_size = 0;
                        tp.creation_flags = 0;
-                       handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)compile_thread_main, user_data, &tp, NULL);
+                       handle = mono_threads_create_thread (compile_thread_main, (gpointer) user_data, &tp, NULL);
                        g_ptr_array_add (threads, handle);
                }
                g_free (methods);
index a814155b33ea5b1ae2aae30295e9ee005f53b818..ed3bee869a155630c8b1f6256d273db39a8487ff 100644 (file)
@@ -727,7 +727,7 @@ static void transport_connect (const char *address);
 static gboolean transport_handshake (void);
 static void register_transport (DebuggerTransport *trans);
 
-static guint32 WINAPI debugger_thread (void *arg);
+static gsize WINAPI debugger_thread (void *arg);
 
 static void runtime_initialized (MonoProfiler *prof);
 
@@ -9809,7 +9809,7 @@ wait_for_attach (void)
  *   This thread handles communication with the debugger client using a JDWP
  * like protocol.
  */
-static guint32 WINAPI
+static gsize WINAPI
 debugger_thread (void *arg)
 {
        MonoError error;
index f10ef37e118ba8d241cc3ca98a07be986e3c0c87..cbf92bb1ce763ee726ca92b17688d746d38089d2 100644 (file)
@@ -40,6 +40,12 @@ extern int tkill (pid_t tid, int signal);
 void nacl_shutdown_gc_thread(void);
 #endif
 
+typedef struct {
+       pthread_t id;
+       GPtrArray *owned_mutexes;
+       gint32 priority;
+} MonoW32HandleThread;
+
 static gpointer
 thread_handle_create (void)
 {
@@ -154,7 +160,7 @@ inner_start_thread (void *arg)
 }
 
 HANDLE
-mono_threads_platform_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
        pthread_attr_t attr;
        int res;
index 499aa2fb276ebd59f68c2606684612b17f37ef02..034200d3173aad0a237c32cacca1de5785d616f7 100644 (file)
@@ -171,7 +171,7 @@ inner_start_thread (LPVOID arg)
 }
 
 HANDLE
-mono_threads_platform_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
        ThreadStartInfo *start_info;
        HANDLE result;
index 5b0b6d030f31a81273b37a68c52e73131873fd42..23a3e759815e66268a5b2504f2ba32e62f23ea6e 100644 (file)
@@ -1127,7 +1127,7 @@ mono_thread_info_is_async_context (void)
  * Returns: a windows or io-layer handle for the thread.
  */
 HANDLE
-mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
        return mono_threads_platform_create_thread (start, arg, tp, out_tid);
 }
index 38547b7e0a90b9df9f5e91f839e420f74c2af049..6e74ec9fb8aa0ef95f5dbabcb429cc35dd680f24 100644 (file)
@@ -32,6 +32,8 @@ typedef DWORD mono_native_thread_return_t;
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) ((MonoNativeThreadId)(tid))
 
+typedef LPTHREAD_START_ROUTINE MonoThreadStart;
+
 #else
 
 #include <pthread.h>
@@ -56,6 +58,8 @@ typedef void* mono_native_thread_return_t;
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (gsize)(tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) (MonoNativeThreadId)(gsize)(tid)
 
+typedef gsize (*MonoThreadStart)(gpointer);
+
 #endif /* #ifdef HOST_WIN32 */
 
 /*
@@ -464,7 +468,7 @@ gboolean
 mono_thread_info_is_live (THREAD_INFO_TYPE *info);
 
 HANDLE
-mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid);
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid);
 
 int
 mono_threads_get_max_stack_size (void);
@@ -532,7 +536,7 @@ void mono_threads_suspend_free (THREAD_INFO_TYPE *info);
 void mono_threads_suspend_abort_syscall (THREAD_INFO_TYPE *info);
 gboolean mono_threads_suspend_needs_abort_syscall (void);
 
-HANDLE mono_threads_platform_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *, MonoNativeThreadId *out_tid);
+HANDLE mono_threads_platform_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *, MonoNativeThreadId *out_tid);
 void mono_threads_platform_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid);
 void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
 gboolean mono_threads_platform_yield (void);