mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +02:00
Added gc_add_mutator
This commit is contained in:
parent
df53ec99a6
commit
f4b62156ba
2 changed files with 18 additions and 0 deletions
17
gc.c
17
gc.c
|
@ -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_heap *gc_heap_create(size_t size, size_t max_size, size_t chunk_size)
|
||||||
{
|
{
|
||||||
gc_free_list *free, *next;
|
gc_free_list *free, *next;
|
||||||
|
|
|
@ -126,6 +126,7 @@ void vpbuffer_free(void **buf);
|
||||||
|
|
||||||
/* GC prototypes */
|
/* GC prototypes */
|
||||||
void gc_init_mutators();
|
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);
|
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);
|
int gc_grow_heap(gc_heap *h, size_t size, size_t chunk_size);
|
||||||
void *gc_try_alloc(gc_heap *h, size_t size);
|
void *gc_try_alloc(gc_heap *h, size_t size);
|
||||||
|
|
Loading…
Add table
Reference in a new issue