diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-03 15:26:26 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-03 15:26:26 -0400 |
| commit | f3e3fd0cdba8d2f9f49be279ac3c0ec87a44609b (patch) | |
| tree | a993e1539cf90362141db8a4c43f1f9f3ff7ef42 /docs/application/thread.md | |
| parent | b26ad08b39b8229dcea0bafc4a8ba4b0d7ad7154 (diff) | |
refs with more impl
Diffstat (limited to 'docs/application/thread.md')
| -rw-r--r-- | docs/application/thread.md | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/docs/application/thread.md b/docs/application/thread.md index 04d9c98..a11c01f 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -23,15 +23,21 @@ typedef struct _kpl_task { } kpl_task; typedef struct { - kpl_task *head, *tail; + kpl_task *queue_head, *queue_tail; pthread_t thread; } kpl_thread; -#define KPL_PROCESSES $(nproc) +#define KPL_THREADS $(nproc) -kpl_thread kpl_worker[KPL_PROCESSES] = {}; +_Atomic uint16_t running; // init to KPL_THREADS -_Atomic uint16_t kpl_worker_running = KPL_PROCESSES; +kpl_task *async_queue_head, *async_queue_tail; + +pthread_mutex_t async_mutex; + +pthread_cond_t async_cond; + +kpl_thread threads[KPL_THREADS]; ``` ## Per Process Task Queue @@ -236,7 +242,7 @@ fib : Fn[n] $ ( n < 2 { 1 } { + (fib `sync n - 1; fib `sync n - 2) } } - v : Vector[`fork_type fib] $ () + v : Array[`fork_type fib] $ () @ 1 .. I { v `push fib `async FIB } @ v {[fib_task] `print "fib(%) = %\n" `format (FIB; `wait fib_task) } `print "Complete\n" |
