diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-11-05 15:22:02 -0500 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-11-05 15:22:02 -0500 |
| commit | 7b9204a8680539bc4795a14f3d9a34e47981d0c3 (patch) | |
| tree | 7aa69bba0c9cbee0cafb638fd49af64958dbb228 /include/kpl/task.h | |
| parent | faa937cb09cd01f4ea94f5d7722a20e9c1246df0 (diff) | |
more objects and special slab for gc
Diffstat (limited to 'include/kpl/task.h')
| -rw-r--r-- | include/kpl/task.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/kpl/task.h b/include/kpl/task.h new file mode 100644 index 0000000..bfdbb4a --- /dev/null +++ b/include/kpl/task.h @@ -0,0 +1,34 @@ +/* + * 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); +} |
