Merge pull request #1691 from esdrubal/exitevent
[mono.git] / mono / metadata / sgen-os-mach.c
index 41d068b1e51512f87037b70cf0ea3057b9b4499b..403d04c3d9a56f95560c27f08f8b55e2d0a0bdd9 100644 (file)
@@ -31,6 +31,7 @@
 #include "metadata/sgen-gc.h"
 #include "metadata/sgen-archdep.h"
 #include "metadata/sgen-protocol.h"
+#include "metadata/sgen-thread-pool.h"
 #include "metadata/object-internals.h"
 #include "metadata/gc-internal.h"
 
@@ -70,8 +71,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
        mono_mach_arch_thread_state_to_mcontext (state, mctx);
        ctx.uc_mcontext = mctx;
 
-       info->stopped_domain = mono_mach_arch_get_tls_value_from_thread (
-               mono_thread_info_get_tid (info), mono_domain_get_tls_key ());
+       info->stopped_domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
        info->stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
        info->stack_start = NULL;
        stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
@@ -92,7 +92,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
        if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
                mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, &ctx, NULL);
 
-       SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)info->info.native_handle, info->stopped_ip, info->stack_start);
+       SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)(gsize)info->info.native_handle, info->stopped_ip, info->stack_start);
 
        binary_protocol_thread_suspend ((gpointer)mono_thread_info_get_tid (info), info->stopped_ip);
 
@@ -115,9 +115,12 @@ sgen_thread_handshake (BOOL suspend)
 
        int count = 0;
 
+       cur_thread->suspend_done = TRUE;
        FOREACH_THREAD_SAFE (info) {
-               if (info == cur_thread || sgen_is_worker_thread (mono_thread_info_get_tid (info)))
+               if (info == cur_thread || sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info)))
                        continue;
+
+               info->suspend_done = FALSE;
                if (info->gc_disabled)
                        continue;
 
@@ -144,5 +147,11 @@ mono_gc_get_suspend_signal (void)
 {
        return -1;
 }
+
+int
+mono_gc_get_restart_signal (void)
+{
+       return -1;
+}
 #endif
 #endif