blob: bfdbb4a7c187e6604fdac2432e8e9635ed524947 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
}
|