Support for coroutines.
More...
◆ gate_coroutine_id_t
unique ID to identify a created coroutine
◆ gate_coroutine_function_t
coroutine entry point function signature
◆ gate_coroutine_supported()
Returns TRUE if coroutines are supported on this platform.
- Returns
- TRUE/FALSE indicating support for coroutines on this platform
◆ gate_coroutine_run()
Starts a coroutine session and executes the first given coroutine.
- Parameters
-
[in] | func | function to be executed as first coroutine in a session |
[in] | param | parameter to be used in first coroutine entry point |
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_enabled()
Returns if a coroutine session is already running.
- Returns
- TRUE/FALSE indicating a running coroutine
◆ gate_coroutine_get_current()
Returns the ID of the currently running coroutine.
- Parameters
-
[in] | ptr_id | Pointer to ID to be overwritten with the current coroutine ID |
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_yield()
Yields execution of current coroutine and switches to the next coroutine.
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_sleep()
Sleeps within the coroutine the defined amount of milliseconds (may causing switches to other routines)
- Parameters
-
[in] | milliseconds | time duration to sleep in milliseconds |
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_create()
Creates a new (suspended) coroutine.
- Parameters
-
[in] | func | entry point function of new coroutine |
[in] | param | parameter to be used in first coroutine entry point |
[in] | ptr_id | pointer to ID that is overwritten with the new created coroutine. |
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_switch_to()
Suspends the current coroutine and switches to the given coroutine to continue exection of its code.
- Parameters
-
[in] | id | coroutine ID to be switched to |
- Returns
- GATE_RESULT_* result code
◆ gate_coroutine_await()
Awaits the completion of a coroutine.
- Parameters
-
[in] | id | coroutine ID to be awaited |
[in] | ptr_coroutine_result | pointer to receive result returned from entry function |
- Returns
- GATE_RESULT_* result code