void mono_thread_hazardous_try_free_some (void) { int i; for (i = 0; i < 10; ++i) try_free_delayed_free_item (FALSE); }
void mono_thread_hazardous_free_or_queue (gpointer p, MonoHazardousFreeFunc free_func, gboolean free_func_might_lock, gboolean lock_free_context) { int i; if (lock_free_context) g_assert (!free_func_might_lock); if (free_func_might_lock) g_assert (!lock_free_context); /* First try to free a few entries in the delayed free table. */ for (i = 0; i < 3; ++i) try_free_delayed_free_item (lock_free_context); /* Now see if the pointer we're freeing is hazardous. If it isn't, free it. Otherwise put it in the delay list. */ if (is_pointer_hazardous (p)) { DelayedFreeItem item = { p, free_func, free_func_might_lock }; ++hazardous_pointer_count; mono_lock_free_array_queue_push (&delayed_free_queue, &item); } else { free_func (p); } }
void mono_thread_hazardous_free_or_queue (gpointer p, MonoHazardousFreeFunc free_func) { int i; /* First try to free a few entries in the delayed free table. */ for (i = 0; i < 3; ++i) try_free_delayed_free_item (); /* Now see if the pointer we're freeing is hazardous. If it isn't, free it. Otherwise put it in the delay list. */ if (is_pointer_hazardous (p)) { DelayedFreeItem item = { p, free_func }; ++mono_stats.hazardous_pointer_count; mono_lock_free_array_queue_push (&delayed_free_queue, &item); } else { free_func (p); } }
void mono_thread_hazardous_try_free_all (void) { while (try_free_delayed_free_item (FALSE)) ; }