* gc.c: If the finalizer thread is delay started
we must ensure that we don't block waiting for finalizers
until it is live.
This is required as the delayed start could happen in
the blocked thread - and deadlock us.
/* Avoid deadlocks */
return;
+ /*
+ If the finalizer thread is not live, lets pretend no finalizers are pending since the current thread might
+ be the one responsible for starting it up.
+ */
+ if (gc_thread == NULL)
+ return;
+
ResetEvent (pending_done_event);
mono_gc_finalize_notify ();
/* g_print ("Waiting for pending finalizers....\n"); */