omni::kit::exec::core::unstable::ParallelSpawner

Defined in omni/kit/exec/core/unstable/ParallelScheduler.h

struct ParallelSpawner

Interface executors use to talk to the scheduler. Every executor object that wishes to use the ParallelScheduler (which is a singleton) will have its own associated instance of ParallelSpawner.

Public Functions

inline ParallelSpawner(graph::exec::unstable::IExecutionContext *context)

Constructor.

inline ~ParallelSpawner()

Destructor.

template<typename Fn>
inline graph::exec::unstable::Status schedule(Fn &&task, graph::exec::unstable::SchedulingInfo schedInfo)

Thread-safe schedule method called by executor to enqueue generated work. Supports parallel, serial and isolate scheduling constraints.

inline void accumulateStatus(graph::exec::unstable::Status ret)

Thread-safe accumulation of status returned by all spawned tasks.

inline graph::exec::unstable::Status getStatus()

Blocking call to acquire accumulated status. When more work is still available, this thread will join the arena and pickup some work OR will be reserved to process serial tasks if we end up here from a serial task (nested scenario).

Protected Attributes

graph::exec::unstable::IExecutionContext *m_context

Execution context used to identify kickstarting threads for the scheduling of serial and isolate tasks.

tbb::empty_task *m_root = {nullptr}

Root task for all spawned tasks.

std::atomic<graph::exec::unstable::Status> m_status = {graph::exec::unstable::Status::eUnknown}

Accumulated status.

ParallelScheduler &m_scheduler

To avoid calling into getSingleton multiple times.