diff options
Diffstat (limited to 'include/kpl/runtime.h')
| -rw-r--r-- | include/kpl/runtime.h | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/include/kpl/runtime.h b/include/kpl/runtime.h deleted file mode 100644 index 2adf402..0000000 --- a/include/kpl/runtime.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * KPL allocators, io and threading - */ - -#pragma once - -#include "base.h" - -typedef enum : uint8_t { - KPL_MEMORY_ALLOCATOR_MIN_POW2 = 7, - KPL_MEMORY_ALLOCATOR_MAX_POW2 = 30 -} kpl_memory_allocator_enum; - -/* - * All allocations are rounded to the next power of two at lest to a min or error if over max - * Each power of two has a bucket in the memory pool for reuse - */ -typedef struct { -// TODO MEMORY ALLOCATOR -} kpl_memory_allocator; - -typedef enum : uint8_t { - KPL_MEMORY_POOL_COUNT = 31 -} kpl_memory_pool_enum; - -// TODO IO URING - -// TODO JIT ALLOCATOR - -typedef struct { - kpl_memory_allocator allocator; - kpl_object_queue memory_pools[KPL_MEMORY_POOL_COUNT]; // each index represents 2 ** INDEX size in bytes - // TODO io_uring - // TODO jit allocator - _Atomic ssize_t priority; // running + the total number of tasks in threads queue, lower is higher priority - kpl_object_queue task_queue; - pthread_t pthread; // not used for main thread - sem_t sem; // wait when no task queue and io queue is empty -} kpl_thread; - -typedef enum : int32_t { - KPL_THREAD_DETERIMINE_COUNT = -1, - KPL_THREAD_MAIN_ID = 0 -} kpl_thread_enum; - -typedef struct _kpl_env { - int32_t thread_count; // -1 updates this value to max possible, 0 invalid, >= 1 for specific number - _Atomic ssize_t total_priority; // the sum of the threads priority fields, application stops on zero - kpl_thread *thread_array; // 0 is main thread, >= 1 are spawned pthreads - kpl_tree *namespace_tree, *module_tree; // *namespace_tree lookups are thread safe, *module_tree needs mutex - pthread_mutex_t module_tree_mutex; -} kpl_env; // kpl state, no globals |
