* cleaning up only if the runtime is shutting down */
g_assert (mono_runtime_is_shutting_down ());
+ MONO_PREPARE_BLOCKING;
while (monitor_status != MONITOR_STATUS_NOT_RUNNING)
g_usleep (1000);
+ MONO_FINISH_BLOCKING;
+ MONO_PREPARE_BLOCKING;
mono_mutex_lock (&threadpool->active_threads_lock);
+ MONO_FINISH_BLOCKING;
/* stop all threadpool->working_threads */
for (i = 0; i < threadpool->working_threads->len; ++i)
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", GetCurrentThreadId ());
+ MONO_PREPARE_BLOCKING;
+
mono_mutex_lock (&threadpool->active_threads_lock);
len = threadpool->parked_threads->len;
if (len > 0) {
}
mono_mutex_unlock (&threadpool->active_threads_lock);
+ MONO_FINISH_BLOCKING;
+
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker, success? %s", GetCurrentThreadId (), res ? "yes" : "no");
return res;
mono_thread_set_name_internal (thread, mono_string_new (mono_domain_get (), "Threadpool worker"), FALSE);
+ MONO_PREPARE_BLOCKING;
mono_mutex_lock (&threadpool->active_threads_lock);
g_ptr_array_add (threadpool->working_threads, thread);
mono_mutex_unlock (&threadpool->active_threads_lock);
+ MONO_FINISH_BLOCKING;
previous_tpdomain = NULL;
mono_mutex_unlock (&threadpool->domains_lock);
+ MONO_PREPARE_BLOCKING;
mono_mutex_lock (&threadpool->active_threads_lock);
g_ptr_array_remove_fast (threadpool->working_threads, thread);
mono_mutex_unlock (&threadpool->active_threads_lock);
+ MONO_FINISH_BLOCKING;
COUNTER_ATOMIC (counter, {
counter._.working--;
if (mono_runtime_is_shutting_down () || !domain_any_has_request ())
continue;
+ MONO_PREPARE_BLOCKING;
mono_mutex_lock (&threadpool->active_threads_lock);
for (i = 0; i < threadpool->working_threads->len; ++i) {
thread = g_ptr_array_index (threadpool->working_threads, i);
}
}
mono_mutex_unlock (&threadpool->active_threads_lock);
+ MONO_FINISH_BLOCKING;
if (all_waitsleepjoin) {
ThreadPoolCounter counter;