X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-threads.c;h=b6e70329c96dc4c6f5660c3d071c3b37f8cde78a;hb=dfac8517b91687f11479801fa0a2191585b1ad4c;hp=5d08308885afd113ee3e52b0abd8b2eb6ed3ead9;hpb=65b4aaf118b2982f2a2db38ad338ab6b6901b36f;p=mono.git diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 5d08308885a..b6e70329c96 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -6,6 +6,7 @@ * * Copyright 2011 Novell, Inc (http://www.novell.com) * Copyright 2011 Xamarin, Inc (http://www.xamarin.com) + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include @@ -424,7 +425,10 @@ unregister_thread (void *arg) g_byte_array_free (info->stackdata, /*free_segment=*/TRUE); /*now it's safe to free the thread info.*/ - mono_thread_hazardous_free_or_queue (info, free_thread_info, HAZARD_FREE_MAY_LOCK, HAZARD_FREE_SAFE_CTX); + mono_thread_hazardous_try_free (info, free_thread_info); + /* Pump the HP queue */ + mono_thread_hazardous_try_free_some (); + mono_thread_small_id_free (small_id); } @@ -1515,27 +1519,3 @@ mono_thread_info_describe_interrupt_token (MonoThreadInfo *info, GString *text) else g_string_append_printf (text, "waiting"); } - -/* info must be self or be held in a hazard pointer. */ -gboolean -mono_threads_add_async_job (MonoThreadInfo *info, MonoAsyncJob job) -{ - MonoAsyncJob old_job; - do { - old_job = (MonoAsyncJob) info->service_requests; - if (old_job & job) - return FALSE; - } while (InterlockedCompareExchange (&info->service_requests, old_job | job, old_job) != old_job); - return TRUE; -} - -MonoAsyncJob -mono_threads_consume_async_jobs (void) -{ - MonoThreadInfo *info = (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key); - - if (!info) - return (MonoAsyncJob) 0; - - return (MonoAsyncJob) InterlockedExchange (&info->service_requests, 0); -}