Added gc_add_mutator

This commit is contained in:
Justin Ethier 2015-11-13 02:51:19 -05:00
parent df53ec99a6
commit f4b62156ba
2 changed files with 18 additions and 0 deletions

17
gc.c
View file

@ -57,6 +57,23 @@ void gc_init_mutators()
}
}
// Add data for a new mutator
void gc_add_mutator(gc_thread_data *thd)
{
// TODO: need to sync access to these static variables. both here and
// elsewhere in the module!!
int i;
for (i = 0; i < Cyc_num_mutators; i++) {
if (!Cyc_mutators[i]) {
Cyc_mutators[i] = thd;
return;
}
}
// TODO: unable to create any more mutators. what to do???
fprintf(stderr, "Unable to create a new thread, exiting\n");
exit(1);
}
gc_heap *gc_heap_create(size_t size, size_t max_size, size_t chunk_size)
{
gc_free_list *free, *next;

View file

@ -126,6 +126,7 @@ void vpbuffer_free(void **buf);
/* GC prototypes */
void gc_init_mutators();
void gc_add_mutator(gc_thread_data *thd);
gc_heap *gc_heap_create(size_t size, size_t max_size, size_t chunk_size);
int gc_grow_heap(gc_heap *h, size_t size, size_t chunk_size);
void *gc_try_alloc(gc_heap *h, size_t size);