Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
task_pool.h File Reference

Optional standard worker population for concurrent application work. More...

Go to the source code of this file.

Data Structures

struct  loomc_task_pool_options_t
 Task-pool creation options. More...

Typedefs

typedef struct loomc_task_pool_t loomc_task_pool_t
 Opaque standard task pool.

Functions

loomc_status_t loomc_task_pool_allocate (const loomc_task_pool_options_t *options, loomc_allocator_t allocator, loomc_task_pool_t **out_pool)
 Allocates a standard task pool and starts its worker population.
loomc_host_size_t loomc_task_pool_worker_count (const loomc_task_pool_t *pool)
 Returns the number of worker threads represented by pool.
void loomc_task_pool_free (loomc_task_pool_t *pool)
 Releases the pool's worker-executor reference and frees pool.

Detailed Description

Optional standard worker population for concurrent application work.

A pool retains one worker executor but no work queue or scheduling policy. Callers attach one loomc_task_queue_t for each independent Loom task domain, while IREE-hosted applications may attach other cooperative processes such as HAL executable or command-buffer materializers. This lets compilation and materialization overlap without creating competing worker populations or forcing unrelated work through one FIFO.

Applications with an existing scheduler use loomc_task_sink_t without linking this package or the IREE task runtime.

Function Documentation

◆ loomc_task_pool_allocate()

loomc_status_t loomc_task_pool_allocate ( const loomc_task_pool_options_t * options,
loomc_allocator_t allocator,
loomc_task_pool_t ** out_pool )

Allocates a standard task pool and starts its worker population.

Parameters
optionsPool configuration, or NULL for defaults.
allocatorHost allocator used for pool and executor storage.
out_poolReceives the allocated pool on success.
Returns
OK when the pool and all worker threads were created.
Ownership
The caller owns out_pool and frees it with loomc_task_pool_free. Task queues and native cooperative processes attached to the pool retain the underlying worker executor independently and may outlive the pool handle.

◆ loomc_task_pool_free()

void loomc_task_pool_free ( loomc_task_pool_t * pool)

Releases the pool's worker-executor reference and frees pool.

Parameters
poolPool to free. Passing NULL is allowed.

Attached task queues and native processes retain the worker executor until their own teardown completes. Freeing the final executor owner joins the worker threads before returning.

◆ loomc_task_pool_worker_count()

loomc_host_size_t loomc_task_pool_worker_count ( const loomc_task_pool_t * pool)

Returns the number of worker threads represented by pool.

Parameters
poolPool to inspect, or NULL.
Returns
Worker count, or zero for a NULL pool.