Aktualizr
C++ SOTA Client
|
Provides a thread-safe way to pause and terminate task execution. More...
#include <apiqueue.h>
Public Member Functions | |
bool | setPause (bool set_paused) |
Called by the controlling thread to request the task to pause or resume. More... | |
bool | setAbort () |
Called by the controlling thread to request the task to abort. More... | |
bool | canContinue (bool blocking=true) const |
Called by the controlled thread to query the currently requested state. More... | |
void | reset () |
Provides a thread-safe way to pause and terminate task execution.
A task must call canContinue() method to check the current state.
Definition at line 19 of file apiqueue.h.
bool api::FlowControlToken::canContinue | ( | bool | blocking = true | ) | const |
Called by the controlled thread to query the currently requested state.
Sleeps if the state is Paused
and blocking == true
.
true
for Running
state, false
for Aborted
, and also false
for the Paused
state, if the call is non-blocking. Definition at line 33 of file apiqueue.cc.
bool api::FlowControlToken::setAbort | ( | ) |
Called by the controlling thread to request the task to abort.
false
if the task was already aborted, true
otherwise. Definition at line 21 of file apiqueue.cc.
bool api::FlowControlToken::setPause | ( | bool | set_paused | ) |
Called by the controlling thread to request the task to pause or resume.
Has no effect if the task was aborted.
true
if the state was changed, false
otherwise. Definition at line 6 of file apiqueue.cc.