|
Loom C API
Public Loom compiler C API
|
Generic Loom task queue attached to a standard task pool. More...
Go to the source code of this file.
Typedefs | |
| typedef struct loomc_task_queue_t | loomc_task_queue_t |
| Opaque generic task queue. | |
Functions | |
| loomc_status_t | loomc_task_queue_allocate (const loomc_task_pool_t *pool, loomc_allocator_t allocator, loomc_task_queue_t **out_queue) |
| Allocates a task queue attached to pool. | |
| loomc_task_sink_t | loomc_task_queue_sink (loomc_task_queue_t *queue) |
| Returns a borrowed generic task sink backed by queue. | |
| loomc_status_t | loomc_task_queue_shutdown (loomc_task_queue_t *queue) |
| Stops accepting new tasks and begins draining accepted work. | |
| loomc_status_t | loomc_task_queue_await_shutdown (loomc_task_queue_t *queue) |
| Waits until every accepted task has drained and the queue process releases. | |
| void | loomc_task_queue_free (loomc_task_queue_t *queue) |
| Drains, awaits, and frees queue. | |
Generic Loom task queue attached to a standard task pool.
A queue is one scheduling and ownership domain backed by one cooperative process on the pool's shared worker executor. Multiple queues attached to one pool can make progress independently at process drain boundaries. This permits compiler, materialization, and application work to overlap while retaining one worker population.
| loomc_status_t loomc_task_queue_allocate | ( | const loomc_task_pool_t * | pool, |
| loomc_allocator_t | allocator, | ||
| loomc_task_queue_t ** | out_queue ) |
Allocates a task queue attached to pool.
| pool | Pool whose worker executor will drain the queue. |
| allocator | Host allocator used for queue storage. |
| out_queue | Receives the allocated queue on success. |
| loomc_status_t loomc_task_queue_await_shutdown | ( | loomc_task_queue_t * | queue | ) |
Waits until every accepted task has drained and the queue process releases.
| queue | Queue whose shutdown has already begun. |
Shutdown must have begun before this call. The calling thread must not be a task executing on queue, because a worker cannot wait for its own release.
| void loomc_task_queue_free | ( | loomc_task_queue_t * | queue | ) |
Drains, awaits, and frees queue.
| queue | Queue to free. Passing NULL is allowed. |
The calling thread must not be a task executing on queue, and no owner may retain or submit through the queue sink after this call begins.
| loomc_status_t loomc_task_queue_shutdown | ( | loomc_task_queue_t * | queue | ) |
Stops accepting new tasks and begins draining accepted work.
| queue | Queue to shut down. |
This operation is thread safe and idempotent. Tasks already executing finish normally. Their attempts to submit additional work are rejected, so owners of recursively expanding work await that work before shutting down its sink.
| loomc_task_sink_t loomc_task_queue_sink | ( | loomc_task_queue_t * | queue | ) |
Returns a borrowed generic task sink backed by queue.
| queue | Queue accepting submitted work, or NULL. |
The sink remains valid until shutdown begins. Rejected submission leaves task ownership with the caller according to the generic sink contract.