Squid::Tasks 1.0.0
C++14 coroutine-based task library for games
Awaiters

Versatile task awaiters that offer utility to most projects. More...

Classes

struct  Suspend
 Awaiter class that suspends unconditionally. More...
 
struct  StopContext
 Context for a task's stop requests (undefined behavior if used after the underlying task is destroyed) More...
 
struct  GetStopContext
 Awaiter class that immediately (without suspending) yields a stop context. More...
 

Functions

Task WaitForAny (std::vector< TaskSingleEntry > in_entries)
 Awaiter task that manages a set of other awaiters and waits until at least one of them is done.
 
Task WaitForAll (std::vector< TaskSingleEntry > in_entries)
 Awaiter task that manages a set of other awaiters and waits until all of them are done.
 
template<class tValue >
Task< tValue > Select (std::vector< TaskSelectEntry< tValue > > in_entries)
 Awaiter task that behaves like WaitForAny(), but returns a value associated with whichever awaiter finishes first.
 
Task WaitUntil (tTaskReadyFn in_readyFn)
 Awaiter function that waits until a given functor returns true.
 
Task WaitWhile (tTaskReadyFn in_readyFn)
 Awaiter function that waits until a given functor returns false.
 
Task WaitForever ()
 Awaiter function that waits forever (only for use in tasks that will be killed externally)
 
template<typename tTimeFn >
Task< tTaskTime > WaitSeconds (tTaskTime in_seconds, tTimeFn in_timeFn)
 Awaiter function that waits N seconds in a given time-stream.
 
template<typename tRet , typename tTimeFn >
auto Timeout (Task< tRet > &&in_task, tTaskTime in_seconds, tTimeFn in_timeFn)
 Awaiter function that wraps a given task, canceling it after N seconds in a given time-stream. Returns whether it timed-out or not.
 
template<typename tFn , typename tTimeFn >
Task DelayCall (tTaskTime in_delaySeconds, tFn in_fn, tTimeFn in_timeFn)
 Awaiter function that calls a given function after N seconds in a given time-stream.
 
Task< tTaskTime > WaitSeconds (tTaskTime in_seconds)
 Awaiter function that waits N seconds in the global time-stream (requires SQUID_ENABLE_GLOBAL_TIME)
 
template<typename tRet >
auto Timeout (Task< tRet > &&in_task, tTaskTime in_seconds)
 Awaiter function that wraps a given task, canceling it after N seconds in the global time-stream. Returns whether it timed-out or not. (requires SQUID_ENABLE_GLOBAL_TIME)
 
template<typename tFn >
Task DelayCall (tTaskTime in_delaySeconds, tFn in_fn)
 Awaiter function that calls a given function after N seconds in the global time-stream (requires SQUID_ENABLE_GLOBAL_TIME)
 

Detailed Description

Versatile task awaiters that offer utility to most projects.