[threads] Rework MonoThreadInfoCallbacks.thread_{register,detach,unregister} callback...
[mono.git] / mono / utils / mono-threads.h
index dc26a4ac42e8d8b4068467a2c90f92cab9025208..95dd036883447d4a71a15c89ab4e4bc7c4bb54ad 100644 (file)
@@ -109,7 +109,7 @@ and reduce the number of casts drastically.
 /* If this is defined, use the signals backed on Mach. Debug only as signals can't be made usable on OSX. */
 // #define USE_SIGNALS_ON_MACH
 
-#if defined (_POSIX_VERSION) || defined (__native_client__)
+#if defined (_POSIX_VERSION)
 #if defined (__MACH__) && !defined (USE_SIGNALS_ON_MACH)
 #define USE_MACH_BACKEND
 #else
@@ -119,7 +119,7 @@ and reduce the number of casts drastically.
 #define USE_WINDOWS_BACKEND
 #else
 #error "no backend support for current platform"
-#endif /* defined (_POSIX_VERSION) || defined (__native_client__) */
+#endif /* defined (_POSIX_VERSION) */
 
 enum {
        STATE_STARTING                          = 0x00,
@@ -222,22 +222,21 @@ typedef struct {
 } MonoThreadInfo;
 
 typedef struct {
-       void* (*thread_register)(THREAD_INFO_TYPE *info, void *baseaddr);
+       void* (*thread_attach)(THREAD_INFO_TYPE *info);
        /*
-       This callback is called with @info still on the thread list.
-       This call is made while holding the suspend lock, so don't do callbacks.
-       SMR remains functional as its small_id has not been reclaimed.
-       */
-       void (*thread_unregister)(THREAD_INFO_TYPE *info);
-       /*
-       This callback is called right before thread_unregister. This is called
+       This callback is called right before thread_detach_with_lock. This is called
        without any locks held so it's the place for complicated cleanup.
 
-       The thread must remain operational between this call and thread_unregister.
-       It must be possible to successfully suspend it after thread_unregister completes.
+       The thread must remain operational between this call and thread_detach_with_lock.
+       It must be possible to successfully suspend it after thread_detach completes.
        */
        void (*thread_detach)(THREAD_INFO_TYPE *info);
-       void (*thread_attach)(THREAD_INFO_TYPE *info);
+       /*
+       This callback is called with @info still on the thread list.
+       This call is made while holding the suspend lock, so don't do callbacks.
+       SMR remains functional as its small_id has not been reclaimed.
+       */
+       void (*thread_detach_with_lock)(THREAD_INFO_TYPE *info);
        gboolean (*mono_method_is_critical) (void *method);
        gboolean (*ip_in_critical_region) (MonoDomain *domain, gpointer ip);
        gboolean (*mono_thread_in_critical_region) (THREAD_INFO_TYPE *info);
@@ -314,7 +313,7 @@ int
 mono_thread_info_register_small_id (void);
 
 THREAD_INFO_TYPE *
-mono_thread_info_attach (void *baseptr);
+mono_thread_info_attach (void);
 
 MONO_API void
 mono_thread_info_detach (void);