AIStatefulTask ‐ Asynchronous, Stateful Task Scheduler library.

Threads-like task objects evolving through user-defined states.

Functions
Going idle and waiting for an event.
Collaboration diagram for Going idle and waiting for an event.:

Functions

void AIStatefulTask::wait (condition_type conditions)
 
void AIStatefulTask::wait_until (AIWaitConditionFunc const &wait_condition, condition_type conditions)
 
void AIStatefulTask::wait_until (AIWaitConditionFunc const &wait_condition, condition_type conditions, state_type new_state)
 

Detailed Description

For a more detailed usage description and overview please see the main page.

These member functions can only be called from within multiplex_impl.

Function Documentation

◆ wait()

void AIStatefulTask::wait ( condition_type  conditions)
protected

Wait for condition.

Go idle if non of the bits of conditions were signaled twice or more since the last call to wait(that_bit). The task will continue whenever signal(condition) is called where conditions & condition != 0.

Parameters
conditionsA bit mask of conditions to wait for.

◆ wait_until() [1/2]

void AIStatefulTask::wait_until ( AIWaitConditionFunc const &  wait_condition,
condition_type  conditions 
)
protected

Block until the wait_condition returns true.

Whenever something changed that might cause wait_condition to return true, signal(condition) must be called. Calling signal(condition) more often is okay.

Parameters
wait_conditionA std::function<bool()> that must return true.
conditionsA bit mask of conditions to wait for.

◆ wait_until() [2/2]

void AIStatefulTask::wait_until ( AIWaitConditionFunc const &  wait_condition,
condition_type  conditions,
state_type  new_state 
)
inlineprotected

Block until the wait_condition returns true.

Whenever something changed that might cause wait_condition to return true, signal(condition) must be called. Calling signal(condition) more often is okay.

Parameters
wait_conditionA std::function<bool()> that must return true.
conditionsA bit mask of conditions to wait for.
new_stateThe new state to continue with once wait_condition returns true.