Lifecycle
-
void lace_start(unsigned int n_workers, size_t dqsize, size_t stacksize)
Start Lace and spawn worker threads.
Allocates per-worker deques and launches
n_workersthreads. Workers begin busy-waiting for tasks immediately. If LACE_BACKOFF is enabled (the default), CPU usage drops to near zero after roughly one second of inactivity.When LACE_USE_MMAP is enabled, deques are allocated as virtual memory and physical pages are committed lazily, so a large
dqsizehas no upfront memory cost.When LACE_USE_HWLOC is enabled, worker threads are pinned to CPU cores.
See also
- Parameters:
n_workers – Number of worker threads. Pass 0 to auto-detect available cores.
dqsize – Task deque size per worker (number of task slots). Pass 0 for a default of 100 000. Each live SPAWN that has not yet been SYNCed occupies one slot.
stacksize – Worker thread stack size in bytes. Pass 0 for the minimum of 16 MB and the calling thread’s stack size.
-
void lace_stop(void)
Stop all workers and free resources.
Must be called from a thread that is not a Lace worker. Do not call from a signal handler.
See also
-
int lace_is_running(void)
Check whether the Lace runtime is currently active.
- Returns:
1 if Lace is running, 0 otherwise
-
void lace_set_verbosity(int level)
Set the verbosity level for Lace startup messages.
Call before lace_start(). Level 0 (default) suppresses output; level 1 prints startup diagnostics.
- Parameters:
level – Verbosity level (0 = silent, 1 = verbose)