Skip to main content

Module spawn

Module spawn 

Source
Expand description

Keep track of how many futures of a certain kind are running (in an AtomicUsize)

Structs§

CountedFut
An AtomicUsize is incremented when building this future, and decremented again when the future completes.
CountedGuard

Statics§

PENDING_HANDLES
Global counter for spawn_counted and spawn_counted_w_handle

Functions§

spawn_blocking_counted_w_handle
Spawn blocking fut as a CountedFut (increments/decrements an AtomicUsize) on the given tokio::runtime::Handle.
spawn_counted
Spawn fut as a CountedFut (increments/decrements an AtomicUsize)
spawn_counted_w_handle
Spawn fut as a CountedFut (increments/decrements an AtomicUsize) on the given tokio::runtime::Handle.
wait_for_all_pending_handles
Waits for PENDING_HANDLES to reach zero. All counted futures must be [Tripwire]-aware, and the tripwire must’ve been tripped, otherwise this is just going to sleep for 600 seconds.