Skip to content

ludus::foundation::threading::WorkerQueue

Ludus Wiki · API overview · Browse API

Class

One dedicated native execution lane with owner-thread completion delivery. Unlike JobSystem, it never helps execute work on the calling thread. Suitable for blocking driver/I/O preparation isolated from the general CPU job pool. All public calls and destruction use one owner thread. Execute callbacks run on the worker; completion callbacks run only in Poll/Shutdown on the owner. Callbacks must not reenter this queue. Initialization may allocate/start a thread; Submit/Poll allocate nothing and never wait for task execution. Browser has no fallback.

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

#include <ludus/foundation/threading/worker_queue.hpp>
class ludus::foundation::threading::WorkerQueue final

Methods

WorkerQueue

ludus::foundation::threading::WorkerQueue::WorkerQueue() noexcept
Construct without allocation or native threads.

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

~WorkerQueue

ludus::foundation::threading::WorkerQueue::~WorkerQueue() noexcept
Drain accepted tasks and deliver every completion on the owner.

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

WorkerQueue

ludus::foundation::threading::WorkerQueue::WorkerQueue(const WorkerQueue &)=delete
Queue ownership is unique.

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

operator=

WorkerQueue & ludus::foundation::threading::WorkerQueue::operator=(const WorkerQueue &)=delete
Queue ownership is unique.

Related types: WorkerQueue

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

Initialize

WorkerQueueStatus ludus::foundation::threading::WorkerQueue::Initialize() noexcept
Allocate fixed storage/start one worker; failure leaves the queue uninitialized.

Related types: WorkerQueueStatus

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

Submit

WorkerQueueStatus ludus::foundation::threading::WorkerQueue::Submit(WorkerQueueFunction execute, WorkerQueueFunction complete, void *contextOrNull) noexcept
Copy callbacks/context into a bounded FIFO. Ready admits ownership of the borrowed context lifetime through completion. Other results call neither callback.

Related types: WorkerQueueStatus · WorkerQueueFunction

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

Poll

bool ludus::foundation::threading::WorkerQueue::Poll() noexcept
Deliver at most one finished task. False leaves queued/running tasks alone. Completion sees every write made by its execute callback.

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp

Shutdown

WorkerQueueStatus ludus::foundation::threading::WorkerQueue::Shutdown() noexcept
Shutdown-only blocking fence: finish accepted work, join the worker, deliver all completions and release storage. Idempotent; InvalidState from a callback.

Related types: WorkerQueueStatus

Declared in modules/foundation/threading/include/ludus/foundation/threading/worker_queue.hpp