![]() |
OS
v1.8.0
Documentation
|
API interface for the Co-Routines extension. More...
Classes | |
| class | qOS::co::position |
| A placeholder for the Co-Routine current position or progress. More... | |
| class | qOS::co::handle |
| A Co-Routine handle. More... | |
| class | qOS::co::semaphore |
| A Co-Routine Semaphore. More... | |
Typedefs | |
| using | qOS::co::state |
| The intrinsic type of co::position to hold a coroutine progress. | |
Functions | |
| void | qOS::co::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 | qOS::co::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 | qOS::co::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 | qOS::co::delay (qOS::duration_t t) noexcept |
| Delay a coroutine for a given number of time. | |
| void | qOS::co::waitUntil (bool condition) noexcept |
| Yields until the logical condition is met. | |
| void | qOS::co::waitUntil (bool condition, qOS::duration_t timeout) noexcept |
| Yields until the logical condition is met or the specified timeout expires. | |
| bool | qOS::co::timeoutExpired (void) noexcept |
| Check if the internal Co-routine timeout expires. | |
| void | qOS::co::restart (void) noexcept |
| This statement cause the running Coroutine to restart its execution at the place of the co::reenter() statement. | |
| void | qOS::co::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 | qOS::co::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 | qOS::co::getPosition (co::position &var) noexcept |
| Labels the current position and saves it to var so it can be later restored by co::setPosition() | |
| void | qOS::co::setPosition (co::position &var) noexcept |
| Restores the Co-Routine position saved in var. | |
| void | qOS::co::perform (void) noexcept |
| This statement start a blocking Job segment. | |
| void | qOS::co::perform (qOS::duration_t t) noexcept |
| This statement start a blocking Job segment. | |
| void | qOS::co::until (bool condition) noexcept |
| This statement ends a blocking Job segment starting with the co::perform() statement. | |
| void | qOS::co::until (bool condition, qOS::duration_t timeout) noexcept |
API interface for the Co-Routines extension.
| using qOS::co::state |
The intrinsic type of co::position to hold a coroutine progress.
|
inlinenoexcept |
Delay a coroutine for a given number of time.
| [in] | t | The amount of time that the calling coroutine should yield. |
|
inlinenoexcept |
Labels the current position and saves it to var so it can be later restored by co::setPosition()
| [out] | var | The variable of type co::position where the current position will be saved. |
|
inlinenoexcept |
This statement start a blocking Job segment.
| [in] | t | The timeout for the specified job segment. |
Example:
|
inlinenoexcept |
This statement start a blocking Job segment.
Example:
|
inlinenoexcept |
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.
| [in] | h | The handle of a coroutine. |
Example:
|
inlinenoexcept |
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.
Example:
|
inlinenoexcept |
This statement cause the running Coroutine to restart its execution at the place of the co::reenter() statement.
Action sequence : [Reload progress] then [Yield]
|
inlinenoexcept |
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.
| [in] | sem | The co::semaphore object in which the operation is executed |
|
inlinenoexcept |
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.
| [in] | sem | The co::semaphore object in which the operation is executed |
|
inlinenoexcept |
Restores the Co-Routine position saved in var.
| [in,out] | var | The variable of type co::position that contains the position to be restored. |
|
inlinenoexcept |
Check if the internal Co-routine timeout expires.
true when timer expires, otherwise, returns false. Example:
|
inlinenoexcept |
This statement ends a blocking Job segment starting with the co::perform() statement.
| [in] | condition | The logical condition to be evaluated. The condition determines if the blocking job ends (if condition is True) or continue yielding (if false) |
|
inlinenoexcept |
|
inlinenoexcept |
Yields until the logical condition is met.
| [in] | condition | The logical condition to be evaluated. The condition determines if the blocking job ends (if condition is true) or continue yielding (if false) * Action sequence : [Save progress]
* IF ( condition == False ) {
* [Yield]
* }
* |
|
inlinenoexcept |
Yields until the logical condition is met or the specified timeout expires.
| [in] | condition | The logical condition to be evaluated. The condition determines if the blocking job ends (if condition is true) or continue yielding (if false) |
| [in] | timeout | The specific amount of time to wait given in milliseconds.. * Action sequence : [Save progress] * IF ( condition == False || NOT_EXPIRED(timeout) ) * [Yield] * } * |
|
inlinenoexcept |
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.
Action sequence : [Save progress] then [Yield]