X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fhazard-pointer.c;h=a662261270d47b94cce659c7f1ad317a89df065b;hb=4437ecea91bab3fe68ba1c30521acf75052662cd;hp=b412e77d7d535ed088203c81a839caa74c545133;hpb=71ad74dc11c5fa4bc8c178a5457d2cab732fdb01;p=mono.git diff --git a/mono/utils/hazard-pointer.c b/mono/utils/hazard-pointer.c index b412e77d7d5..a662261270d 100644 --- a/mono/utils/hazard-pointer.c +++ b/mono/utils/hazard-pointer.c @@ -46,7 +46,7 @@ static volatile gint32 overflow_busy [HAZARD_TABLE_OVERFLOW]; static MonoLockFreeArrayQueue delayed_free_queue = MONO_LOCK_FREE_ARRAY_QUEUE_INIT (sizeof (DelayedFreeItem)); /* The table for small ID assignment */ -static CRITICAL_SECTION small_id_mutex; +static mono_mutex_t small_id_mutex; static int small_id_next; static int highest_small_id = -1; static MonoBitSet *small_id_table; @@ -63,7 +63,7 @@ mono_thread_small_id_alloc (void) { int i, id = -1; - EnterCriticalSection (&small_id_mutex); + mono_mutex_lock (&small_id_mutex); if (!small_id_table) small_id_table = mono_bitset_new (1, 0); @@ -125,7 +125,7 @@ mono_thread_small_id_alloc (void) mono_memory_write_barrier (); } - LeaveCriticalSection (&small_id_mutex); + mono_mutex_unlock (&small_id_mutex); return id; } @@ -134,13 +134,13 @@ void mono_thread_small_id_free (int id) { /* MonoBitSet operations are not atomic. */ - EnterCriticalSection (&small_id_mutex); + mono_mutex_lock (&small_id_mutex); g_assert (id >= 0 && id < small_id_table->size); g_assert (mono_bitset_test_fast (small_id_table, id)); mono_bitset_clear_fast (small_id_table, id); - LeaveCriticalSection (&small_id_mutex); + mono_mutex_unlock (&small_id_mutex); } static gboolean @@ -345,7 +345,7 @@ mono_thread_smr_init (void) { int i; - InitializeCriticalSection(&small_id_mutex); + mono_mutex_init_recursive(&small_id_mutex); mono_counters_register ("Hazardous pointers", MONO_COUNTER_JIT | MONO_COUNTER_INT, &hazardous_pointer_count); for (i = 0; i < HAZARD_TABLE_OVERFLOW; ++i) {