summaryrefslogtreecommitdiff
path: root/docs/application/thread.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/application/thread.md')
-rw-r--r--docs/application/thread.md16
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"