libkoishi
Decently portable C11 coroutine library
Utility functions.

Functions

KOISHI_API size_t koishi_util_page_size (void)
 Query the system's page size. More...
 
KOISHI_API size_t koishi_util_real_stack_size (size_t min_size)
 Query the real stack size for a given minimum. More...
 

Detailed Description

Function Documentation

◆ koishi_util_page_size()

KOISHI_API size_t koishi_util_page_size ( void  )

Query the system's page size.

The page size is queried only once and then cached.

Returns
The page size in bytes.

◆ koishi_util_real_stack_size()

KOISHI_API size_t koishi_util_real_stack_size ( size_t  min_size)

Query the real stack size for a given minimum.

This function computes the exact stack size that koishi_init would allocate given min_size.

Returns
The real stack size. It is the closest multiple of the system page size that is equal or greater than double the pace size.