libkoishi
Decently portable C11 coroutine library
Advanced, low-level, and/or backend-specific APIs.

Functions

KOISHI_API void * koishi_get_stack (koishi_coroutine_t *co, size_t *stack_size)
 Query the coroutine's stack region. More...
 

Detailed Description

Function Documentation

◆ koishi_get_stack()

KOISHI_API void* koishi_get_stack ( koishi_coroutine_t co,
size_t *  stack_size 
)

Query the coroutine's stack region.

Warning
This function may not be supported by some backends. Some backends may also embed their control structures into the stack at context creation time, which are not safe to overwrite. Do not use this function unless you fully understand what you're doing.
Returns
A pointer to the beginning of the stack memory region. This is always the lower end, regardless of stack growth direction. Returns NULL if not supported by the backend. Note that some backends may only support querying user-created coroutines, but not the thread's main context.
Parameters
coThe coroutine to query.
stack_sizeIf not NULL, the stack size is written to memory at this location. NULL is written if not supported by the backend.