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 and that each
thread also keeps a private cached stack in TLS. Other threads may push
stacks back into the pool (for example, when their Wasm execution
finishes) while or after this function is running, and TLS-cached stacks
on other threads are not touched. As a result, this function provides
only a best-effort drain: 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. The current thread’s TLS-cached stack is
drained as part of this call.