diff options
Diffstat (limited to 'include/kpl/gc.h')
| -rw-r--r-- | include/kpl/gc.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/include/kpl/gc.h b/include/kpl/gc.h index 6ed4fc4..bd99a9a 100644 --- a/include/kpl/gc.h +++ b/include/kpl/gc.h @@ -24,17 +24,18 @@ inline void kpl_gc_init(kpl_gc *gc) { /* * Create a new gc node and a new kpl_object with object_size * Add the node to the gc_head - * Returns the new kpl_gc_object + * Returns the new kpl_object, which has a pointer to the kpl_gc_object * Only owner thread calls this */ -kpl_object_gc *kpl_gc_new(kpl_thread *thread, kpl_interface *interface, int32_t object_size); +void *kpl_gc_new(kpl_thread *thread, kpl_interface *interface, int32_t object_size); /* - * Remove node from gc_head - * Free gc node and the object it wraps - * Only owner thread call this during sweep or free + * Delete an object on gc_head before sweeping + * *object is the object the gc is tracking NOT a kpl_object_gc + * Many objects can be removed from the gc before sweep and is done though this + * *object is not void, force casting to prevent memory errors */ -void kpl_gc_delete(kpl_thread *thread, kpl_object_gc *object_gc); +void kpl_gc_delete(kpl_thread *thread, kpl_object *object); /* * Mark a gc object @@ -64,11 +65,4 @@ void kpl_gc_sweep(kpl_thread *thread); /* * Run delete on all objects on gc_head */ -inline void kpl_gc_free(kpl_gc *gc, kpl_thread *thread) { - kpl_object_gc *head = gc->gc_head; - while (head) { - kpl_object_gc *tmp = head; - head = head->gc_next; - kpl_gc_delete(thread, tmp); - } -} +void kpl_gc_free(kpl_thread *thread); |
