Aktualizr
C++ SOTA Client
Public Member Functions | List of all members
api::FlowControlToken Class Reference

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 ()
 

Detailed Description

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.

Member Function Documentation

◆ canContinue()

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.

Returns
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.

◆ setAbort()

bool api::FlowControlToken::setAbort ( )

Called by the controlling thread to request the task to abort.

Returns
false if the task was already aborted, true otherwise.

Definition at line 21 of file apiqueue.cc.

◆ setPause()

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.

Returns
true if the state was changed, false otherwise.

Definition at line 6 of file apiqueue.cc.


The documentation for this class was generated from the following files: