Go to the source code of this file.
|
| struct | KlWorkItem |
| | Work item — passed by pointer to kl_thread_pool_submit. Copied into the internal queue (caller can stack-allocate). More...
|
| |
| struct | KlThreadPoolConfig |
| | Thread pool configuration. All fields have sensible defaults when set to 0/NULL. More...
|
| |
|
| typedef struct KlEventCtx | KlEventCtx |
| |
| typedef void(* | KlWorkFn) (void *user_data) |
| | Work function — runs on a worker thread.
|
| |
| typedef void(* | KlWorkDoneFn) (void *user_data) |
| | Done function — runs on the event loop thread after work completes.
|
| |
| typedef void(* | KlWorkCancelFn) (void *user_data) |
| | Cancel function — runs on shutdown if work item never started.
|
| |
| typedef struct KlWorkItem | KlWorkItem |
| | Work item — passed by pointer to kl_thread_pool_submit. Copied into the internal queue (caller can stack-allocate).
|
| |
| typedef struct KlThreadPoolConfig | KlThreadPoolConfig |
| | Thread pool configuration. All fields have sensible defaults when set to 0/NULL.
|
| |
| typedef struct KlThreadPool | KlThreadPool |
| |
◆ KlEventCtx
◆ KlWorkFn
| typedef void(* KlWorkFn) (void *user_data) |
Work function — runs on a worker thread.
◆ KlWorkDoneFn
| typedef void(* KlWorkDoneFn) (void *user_data) |
Done function — runs on the event loop thread after work completes.
◆ KlWorkCancelFn
| typedef void(* KlWorkCancelFn) (void *user_data) |
Cancel function — runs on shutdown if work item never started.
◆ KlWorkItem
Work item — passed by pointer to kl_thread_pool_submit. Copied into the internal queue (caller can stack-allocate).
◆ KlThreadPoolConfig
Thread pool configuration. All fields have sensible defaults when set to 0/NULL.
◆ KlThreadPool
◆ kl_thread_pool_create()
Create pool, start worker threads, register pipe watcher with ctx.
- Parameters
-
| ctx | Event context (for event loop + allocator). |
| cfg | Configuration (NULL = all defaults). |
- Returns
- Pool on success, NULL on failure.
◆ kl_thread_pool_submit()
Submit work. Copies *item into the internal queue.
- Parameters
-
| pool | Thread pool. |
| item | Work item (copied — caller can stack-allocate). |
- Returns
- 0 on success, -1 if queue full (backpressure).
◆ kl_thread_pool_free()
Drain queue, join threads, remove watcher, free.