From aebce1e48e81559ffe5f496af855a1140d8e0107 Mon Sep 17 00:00:00 2001 From: nodist Date: Wed, 10 Jun 2026 10:21:32 -0400 Subject: rename shared qualifier to gc --- docs/application/gc.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'docs/application/gc.md') diff --git a/docs/application/gc.md b/docs/application/gc.md index e171a05..764285b 100644 --- a/docs/application/gc.md +++ b/docs/application/gc.md @@ -5,14 +5,19 @@ ## Object Definition ```c +typedef enum : uint16_t { + LOCK_MUTEX = 1 << 0, +} kpl_gc_flags; + typedef struct _kpl_gc { POOL_HEADER(_kpl_gc); _Atomic bool mark; + int16_t flags; kpl_any any; pthread_mutex_t mutex; } kpl_gc; -static _Atomic size_t gc_threads; +static _Atomic int32_t gc_threads; static pthread_mutex_t gc_head_mutex; @@ -25,5 +30,6 @@ static kpl_gc *gc_head_sweep, *gc_head; 2. This task moves the `gc_head` to the `gc_head_sweep` and sets the `gc_wait` to off for each thread 3. Each thread will run down its queue queue marking found gc objects 3. Once all have run and `gc_threads == available_threads` add a mark and sweep task to the async queue -4. Async task goes down async queue and does final mark, then a sweep on the `gc_head_sweep` is done -5. What remains on the `gc_head_sweep` is added to `gc_head` +4. The async queue is moved to a temp queue and as each item on the tmep queue is marked it is moved back to the async queue +5. A sweep on the `gc_head_sweep` is done +6. What remains on the `gc_head_sweep` is added to `gc_head` -- cgit v1.2.3