AIStatefulTask ‐ Asynchronous, Stateful Task Scheduler library.

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

Functions
Public control functions.

Functions

void AIStatefulTask::kill ()
 
void AIStatefulTask::abort ()
 
bool AIStatefulTask::signal (condition_type condition)
 

Detailed Description

Function Documentation

◆ abort()

void AIStatefulTask::abort ( )

Abort the task (unsuccessful finish).

This function can be called from multiplex_impl, but also by a child task and therefore by any thread. The child task should use a boost::intrusive_ptr<AIStatefulTask> to access this task.

A call to abort and finish will cause a task to not call multiplex_impl again at all after leaving it (except when finish_impl calls run again, in which case the task is restarted from the beginning).

◆ kill()

void AIStatefulTask::kill ( )

Terminate a task from the call back.

This function may only be called from the call back function (and cancels a call to run from finish_impl).

◆ signal()

bool AIStatefulTask::signal ( condition_type  condition)

Wake up a waiting task.

This is the only control function that can be called by any thread at any moment.

Those threads should use a boost::intrusive_ptr<AIStatefulTask> to access this task.

Guarantee at least one full run of multiplex iff this task is still blocked since the last call to wait(conditions) where (conditions & condition) != 0.

Parameters
conditionThe condition that might have changed, or that the task is waiting for.
Returns
false if it already unblocked or is waiting on (a) different condition(s) now.