diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-09-20 19:14:31 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-09-20 19:14:31 -0400 |
| commit | d93466b950ff760a1dd7fd0c2d8ae72c8f1ee0b5 (patch) | |
| tree | 0bb220009fd115388b9d35f19ffcda890b0684b5 /include/kpl | |
| parent | 260e50d627aea535abcd9d9902c1b4ae56da4c54 (diff) | |
change thread section to process
Diffstat (limited to 'include/kpl')
| -rw-r--r-- | include/kpl/io.h | 4 | ||||
| -rw-r--r-- | include/kpl/process.h | 44 | ||||
| -rw-r--r-- | include/kpl/system.h | 2 | ||||
| -rw-r--r-- | include/kpl/thread.h | 10 | ||||
| -rw-r--r-- | include/kpl/type.h | 5 |
5 files changed, 55 insertions, 10 deletions
diff --git a/include/kpl/io.h b/include/kpl/io.h index 2b33755..9a85d1f 100644 --- a/include/kpl/io.h +++ b/include/kpl/io.h @@ -14,3 +14,7 @@ typedef enum : int32_t { typedef struct { int32_t queue_pow; } kpl_config_io; + +typedef struct { + +} kpl_io; diff --git a/include/kpl/process.h b/include/kpl/process.h new file mode 100644 index 0000000..d46fd2f --- /dev/null +++ b/include/kpl/process.h @@ -0,0 +1,44 @@ + +#pragma once + +// Kpl threads, allocators, atomic queues and garbage collection + +#include "kpl/macro.h" + +typedef struct { + int32_t count; +} kpl_config_thread; + +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 { + struct _kpl_task *_Atomic next, *join; + // TODO + kpl_result result; + int32_t thread_id; + _Atomic bool join_ready; +} kpl_task; + +typedef struct { + kpl_task *_Atomic head, *_Atomic tail; + struct { + kpl_task *_Atomic next; + } dummy; +} kpl_task_queue; + +typedef struct { + kpl_task_queue task_queue; + _Atomic ssize_t priority; + // TODO + sem_t spin_counter; + pthread_t thread; +} kpl_thread; + +typedef struct { + _Atomic ssize_t total_priority; + kpl_thread *threads; +} kpl_process; diff --git a/include/kpl/system.h b/include/kpl/system.h index 06e8ad3..201c1b6 100644 --- a/include/kpl/system.h +++ b/include/kpl/system.h @@ -8,3 +8,5 @@ #include <stdint.h> #include <stdbool.h> #include <string.h> +#include <pthread.h> +#include <semaphore.h> diff --git a/include/kpl/thread.h b/include/kpl/thread.h deleted file mode 100644 index 7304340..0000000 --- a/include/kpl/thread.h +++ /dev/null @@ -1,10 +0,0 @@ - -#pragma once - -// Kpl threads, allocators ad atomic queues - -#include "kpl/macro.h" - -typedef struct { - int32_t count; -} kpl_config_thread; diff --git a/include/kpl/type.h b/include/kpl/type.h index b18f6ae..b068080 100644 --- a/include/kpl/type.h +++ b/include/kpl/type.h @@ -27,3 +27,8 @@ typedef union { double f64; void *ptr; } kpl_value; + +typedef struct { + kpl_value value; + int64_t tag; +} kpl_result; |
