Skip to content

EntropyEngine::Core::Concurrency::WorkResultContext

EntropyEngine::Core::Concurrency::WorkResultContext

Section titled “EntropyEngine::Core::Concurrency::WorkResultContext”

Extended result context for yieldable work functions with timing support. More…

#include <WorkGraphTypes.h>

Name
WorkResultContextyieldUntil(std::chrono::steady_clock::time_point when)
Creates a timed yield result (reschedule at specific time).
WorkResultContextyield()
Creates an immediate yield result (reschedule ASAP).
WorkResultContextcomplete()
Creates a completion result.
Name
std::optional< std::chrono::steady_clock::time_point >wakeTime
WorkResultresult
struct EntropyEngine::Core::Concurrency::WorkResultContext;

Extended result context for yieldable work functions with timing support.

Provides fine-grained control over when a yielded node should be rescheduled. Use the static factory methods for convenience.

// Immediate reschedule (old behavior)
return WorkResultContext::yield();
// Timed reschedule (new - for timers, polling, etc.)
auto wakeTime = std::chrono::steady_clock::now() + std::chrono::seconds(5);
return WorkResultContext::yieldUntil(wakeTime);
// Completion
return WorkResultContext::complete();
static inline WorkResultContext yieldUntil(
std::chrono::steady_clock::time_point when
)

Creates a timed yield result (reschedule at specific time).

Parameters:

  • when The time point when the node should be rescheduled

Return: WorkResultContext configured for timed yield

Note: If the wake time is in the past or current time, the system treats it as an immediate yield (equivalent to calling yield()), rescheduling as soon as possible rather than failing or blocking.

Defers node execution until the specified wake time without consuming CPU resources. The node will be rescheduled for execution when the wake time is reached.

static inline WorkResultContext yield()

Creates an immediate yield result (reschedule ASAP).

static inline WorkResultContext complete()

Creates a completion result.

std::optional< std::chrono::steady_clock::time_point > wakeTime;
WorkResult result = WorkResult::Complete;

Updated on 2026-01-26 at 17:14:35 -0500