/* * KPL task methods */ #pragma once /* * Create a new task */ kpl_object_task *kpl_object_task_create(kpl_thread *thread, int32_t variables_size, uint64_t variables_gc_mask); /* * Delete object in gc before sweep */ inline void kpl_object_task_destroy(kpl_thread *thread, kpl_object_task *object_task) { kpl_gc_delete(thread, (kpl_object*) object_task); } /* * Queue join task * Done needs to be called twice, once by joining the task and once the task is done * The joining or completing can be called in any order * Once both done functions are called the join task is queued */ void kpl_object_task_done(kpl_thread *thread, kpl_object_task *object_task); /* * Set the task to queue next after kpl_task_complete finishes */ inline void kpl_object_task_join(kpl_thread *thread, kpl_object_task *restrict object_task_complete, kpl_object_task *restrict object_task_join) { object_task_complete->join_task = object_task_join; kpl_object_task_done(thread, object_task_complete); }