aboutsummaryrefslogtreecommitdiff
path: root/include/kpl/runtime.h
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-10-12 11:06:37 -0400
committernodist <kevin.comas.git@gmail.com>2026-10-12 11:06:37 -0400
commit332c114cf633f70027c28ec6bedb898d9de85e51 (patch)
tree0a9bb4760772e5e407c1aef9b896d65165f82f6c /include/kpl/runtime.h
parent4ee5b8d6a9ebf49ce30ff7d93ef7401039ffecc6 (diff)
basic allocator with valgrind testing
Diffstat (limited to 'include/kpl/runtime.h')
-rw-r--r--include/kpl/runtime.h52
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