OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
qOS::co Namespace Reference

CoRoutines interfaces. More...

Classes

class  handle
 A Co-Routine handle. More...
 
class  position
 A placeholder for the Co-Routine current position or progress. More...
 
class  semaphore
 A Co-Routine Semaphore. More...
 

Typedefs

using state
 The intrinsic type of co::position to hold a coroutine progress.
 

Functions

void reenter (void) noexcept
 Defines a Coroutine segment. The co::reenter() statement is used to declare the starting point of a Coroutine. It should be placed at the start of the function in which the Coroutine runs.
 
void reenter (qOS::co::handle h) noexcept
 Defines a Coroutine segment with a supplied external handle. The co::reenter() statement is used to declare the starting point of a Coroutine. It should be placed at the start of the function in which the Coroutine runs.
 
void yield (void) noexcept
 This statement is only allowed inside a Coroutine segment. co::yield return the CPU control back to the scheduler but saving the execution progress. With the next task activation, the Coroutine will resume the execution after the last co::yield statement.
 
void delay (qOS::duration_t t) noexcept
 Delay a coroutine for a given number of time.
 
void waitUntil (bool condition) noexcept
 Yields until the logical condition is met.
 
void waitUntil (bool condition, qOS::duration_t timeout) noexcept
 Yields until the logical condition is met or the specified timeout expires.
 
bool timeoutExpired (void) noexcept
 Check if the internal Co-routine timeout expires.
 
void restart (void) noexcept
 This statement cause the running Coroutine to restart its execution at the place of the co::reenter() statement.
 
void semWait (co::semaphore &sem) noexcept
 Carries out the "wait" operation on the semaphore. The wait operation causes the Co-routine to block while the counter is zero. When the counter reaches a value larger than zero, the Coroutine will continue.
 
void semSignal (co::semaphore &sem) noexcept
 Carries out the "signal" operation on the semaphore. The signal operation increments the counter inside the semaphore, which eventually will cause waiting Co-routines to continue executing.
 
void getPosition (co::position &var) noexcept
 Labels the current position and saves it to var so it can be later restored by co::setPosition()
 
void setPosition (co::position &var) noexcept
 Restores the Co-Routine position saved in var.
 
void perform (void) noexcept
 This statement start a blocking Job segment.
 
void perform (qOS::duration_t t) noexcept
 This statement start a blocking Job segment.
 
void until (bool condition) noexcept
 This statement ends a blocking Job segment starting with the co::perform() statement.
 

Detailed Description

CoRoutines interfaces.