Added gc_is_mutator_active()

This commit is contained in:
Justin Ethier 2017-06-17 01:01:59 -04:00
parent 5e0fb7edc7
commit 64be028166
2 changed files with 13 additions and 0 deletions

12
gc.c
View file

@ -195,6 +195,18 @@ void gc_remove_mutator(gc_thread_data * thd)
pthread_mutex_unlock(&mutators_lock);
}
int gc_is_mutator_active(gc_thread_data *thd)
{
ck_array_iterator_t iterator;
gc_thread_data *m;
CK_ARRAY_FOREACH(&Cyc_mutators, &iterator, &m) {
if (m == thd) {
return 1;
}
}
return 0;
}
/**
* @brief Free thread data for all terminated mutators
*/

View file

@ -306,6 +306,7 @@ struct gc_thread_data_t {
void gc_initialize(void);
void gc_add_mutator(gc_thread_data * thd);
void gc_remove_mutator(gc_thread_data * thd);
int gc_is_mutator_active(gc_thread_data *thd);
gc_heap *gc_heap_create(int heap_type, size_t size, size_t max_size,
size_t chunk_size, gc_thread_data *thd);
gc_heap *gc_heap_free(gc_heap *page, gc_heap *prev_page);