drain_stack_pool

Function drain_stack_pool 

pub fn drain_stack_pool()
Expand description

Drains the coroutine stack pool at the moment it runs.

This is intended to be called before retrying with a larger stack size so that the pool does not keep serving cached undersized stacks.

Note that STACK_POOL is a global, concurrently used queue. Other threads may push stacks back into the pool (for example, when their Wasm execution finishes) while or after this function is running. As a result, this function provides only a best-effort drain of the pool: there is no guarantee that no undersized stacks exist immediately after it returns unless the caller ensures, via external synchronization, that no other Wasm executions can return stacks to the pool while this function runs.