Add a new 'MONO_DEBUGGER_EVENT_TRAMPOLINE' notification for the debugger which also...
[mono.git] / mono / metadata / threadpool.c
index 2a8d49bfe405a547477e0897196dd68663bdba12..6e6782a861918200124dc1ec93d4c98e6d9fb2d9 100644 (file)
@@ -1289,6 +1289,7 @@ threadpool_queue_idle_thread (ThreadPool *tp, IdleThreadData *it)
        EnterCriticalSection (cs);
        if (tp->idle_threads == NULL) {
                it->die = TRUE;
+               LeaveCriticalSection (cs);
                return NULL; /* We are shutting down */
        }
        /*
@@ -1332,8 +1333,10 @@ threadpool_append_job (ThreadPool *tp, MonoObject *ar)
        cs = &tp->lock;
        threadpool_jobs_inc (ar); 
        EnterCriticalSection (cs);
-       if (tp->idle_threads == NULL)
+       if (tp->idle_threads == NULL) { 
+               LeaveCriticalSection (cs);
                return; /* We are shutting down */
+       }
        if (ar->vtable->domain->state == MONO_APPDOMAIN_UNLOADING ||
                        ar->vtable->domain->state == MONO_APPDOMAIN_UNLOADED) {
                LeaveCriticalSection (cs);