Add mono_gc_thread_detach callback for Boehm
Use under Boehm to detach without threads lock as Boehm will take it's own lock internally.
Note in `on_gc_notification` we take threads lock after Boehm already has it's own lock. For consistency and to prevent deadlocks always take lock ordering of Boehm then threads lock.
Commit migrated from https://github.com/mono/mono/commit/
480bef72172856bd0f1a57243ddb53e98684f7d1
}
void
+mono_gc_thread_detach (MonoThreadInfo *p)
+{
+ /* Detach without threads lock as Boehm
+ * will take it's own lock internally. Note in
+ * on_gc_notification we take threads lock after
+ * Boehm already has it's own lock. For consistency
+ * always take lock ordering of Boehm then threads.
+ */
+ GC_unregister_my_thread ();
+}
+
+void
mono_gc_thread_detach_with_lock (MonoThreadInfo *p)
{
MonoNativeThreadId tid;
gpointer mono_gc_thread_attach (THREAD_INFO_TYPE *info);
G_EXTERN_C // due to THREAD_INFO_TYPE varying
+void mono_gc_thread_detach (THREAD_INFO_TYPE *info);
+
+G_EXTERN_C // due to THREAD_INFO_TYPE varying
void mono_gc_thread_detach_with_lock (THREAD_INFO_TYPE *info);
G_EXTERN_C // due to THREAD_INFO_TYPE varying
}
void
+mono_gc_thread_detach (MonoThreadInfo *p)
+{
+}
+
+void
mono_gc_thread_detach_with_lock (MonoThreadInfo *p)
{
mono_handle_stack_free (p->handle_stack);
}
void
+mono_gc_thread_detach (SgenThreadInfo *info)
+{
+}
+
+void
mono_gc_thread_detach_with_lock (SgenThreadInfo *info)
{
return sgen_thread_detach_with_lock (info);
g_assert (internal);
mono_thread_detach_internal (internal);
+
+ mono_gc_thread_detach (info);
}
static void