#define HAZARD_TABLE_OVERFLOW 64 #endif static volatile int hazard_table_size = 0; static MonoThreadHazardPointers * volatile hazard_table = NULL; static MonoHazardFreeQueueSizeCallback queue_size_cb; /* * Each entry is either 0 or 1, indicating whether that overflow small * ID is busy. */ static volatile gint32 overflow_busy [HAZARD_TABLE_OVERFLOW]; /* The table where we keep pointers to blocks to be freed but that have to wait because they're guarded by a hazard pointer. */ static MonoLockFreeArrayQueue delayed_free_queue = MONO_LOCK_FREE_ARRAY_QUEUE_INIT (sizeof (DelayedFreeItem), MONO_MEM_ACCOUNT_HAZARD_POINTERS); /* The table for small ID assignment */ static mono_mutex_t small_id_mutex; static int small_id_next; static int highest_small_id = -1; static MonoBitSet *small_id_table; static int hazardous_pointer_count; /* * Allocate a small thread id. * * FIXME: The biggest part of this function is very similar to * domain_id_alloc() in domain.c and should be merged. */ int
#define HAZARD_TABLE_MAX_SIZE 16384 /* There cannot be more threads than this number. */ #define HAZARD_TABLE_OVERFLOW 64 #endif static volatile int hazard_table_size = 0; static MonoThreadHazardPointers * volatile hazard_table = NULL; /* * Each entry is either 0 or 1, indicating whether that overflow small * ID is busy. */ static volatile gint32 overflow_busy [HAZARD_TABLE_OVERFLOW]; /* The table where we keep pointers to blocks to be freed but that have to wait because they're guarded by a hazard pointer. */ static MonoLockFreeArrayQueue delayed_free_queue = MONO_LOCK_FREE_ARRAY_QUEUE_INIT (sizeof (DelayedFreeItem)); /* The table for small ID assignment */ static mono_mutex_t small_id_mutex; static int small_id_next; static int highest_small_id = -1; static MonoBitSet *small_id_table; static int hazardous_pointer_count; /* * Allocate a small thread id. * * FIXME: The biggest part of this function is very similar to * domain_id_alloc() in domain.c and should be merged. */ int