diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-10-06 17:13:01 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-10-06 17:13:01 -0400 |
| commit | 7bd050ccf74222e1b659f2fd6826a86e6afbcc94 (patch) | |
| tree | 30bae9ca5dd110f32cd4abb10d42ea4d872b4d82 /include/kpl/object.h | |
| parent | de65adbc1b2d1b3efdbe6a023bb7435f84b2f3a7 (diff) | |
basic tests
Diffstat (limited to 'include/kpl/object.h')
| -rw-r--r-- | include/kpl/object.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/kpl/object.h b/include/kpl/object.h new file mode 100644 index 0000000..0f54a5e --- /dev/null +++ b/include/kpl/object.h @@ -0,0 +1,33 @@ +/* + * KPL specific objects + */ + +#pragma once + +// for atomic linked list queue +// size in bytes, index on the kpl_threads array +#define KPL_OBJECT_HEADER(STRUCT_NAME) \ + struct STRUCT_NAME *_Atomic queue_next; \ + int32_t obj_size, thread_id + +typedef struct _kpl_object { + KPL_OBJECT_HEADER(_kpl_object); +} kpl_object; // all kpl objects allocated by the kpl allocator extend this header + +typedef struct { + kpl_object *_Atomic head, *tail; // head is modified with atomic exchange + struct { + kpl_object *_Atomic queue_next; + } dummy; // head and tail are never null will always point to this +} kpl_object_queue; // atomic linked list queue any thread can add, only owner thread can remove + +typedef struct _kpl_task kpl_task; + +typedef struct _kpl_env kpl_env; + +typedef void kpl_task_fn(kpl_task *task, kpl_env *env); + +typedef struct _kpl_task { + KPL_OBJECT_HEADER(_kpl_task); + // TODO +} kpl_task; |
