tur/threadpool
stdlib/threadpool.tur
defn
work-queue-new
(work-queue-new :ptr<void>)
create a new unbounded work queue that grows dynamically.
Since: Phase T20-B
defn
work-queue-new-bounded
(work-queue-new-bounded [cap :int] :ptr<void>)
create a new bounded work queue with a fixed capacity.
Parameters
| cap | maximum number of items the queue can hold; push blocks when full |
Since: Phase T20-B
defn
work-queue-push
(work-queue-push [q :ptr<void> v :int] :nil)
push a value onto the work queue, blocking if the queue is bounded and full.
Parameters
| q | queue handle returned by work-queue-new or work-queue-new-bounded | |
| v | int64_t value to enqueue |
Since: Phase T20-B
defn
work-queue-pop
(work-queue-pop [q :ptr<void>] :int)
pop a value from the work queue, blocking until one is available.
Parameters
| q | queue handle returned by work-queue-new or work-queue-new-bounded |
Since: Phase T20-B
defn
work-queue-close
(work-queue-close [q :ptr<void>] :nil)
close the work queue, waking all blocked producers and consumers.
Parameters
| q | queue handle returned by work-queue-new or work-queue-new-bounded |
Since: Phase T20-B
defn
work-queue-free
(work-queue-free [q :ptr<void>] :nil)
destroy a work queue and release all associated memory.
Parameters
| q | queue handle returned by work-queue-new or work-queue-new-bounded |
Since: Phase T20-B
defn
tp-worker
(tp-worker [arg :ptr<void>] :ptr<void>)
internal worker thread function for a fixed ThreadPool.
Parameters
| arg | ptr<void> pointing to the ThreadPoolBlock |
Since: Phase T20-D