Skip to main content

install_spawner

Function install_spawner 

Source
pub fn install_spawner(spawner: Arc<dyn ProcessSpawner>) -> SpawnerGuard
Expand description

Install a per-thread spawner used by spawn_process from this thread. Returns a guard that restores the previous spawner on drop. Tests use this to install a super::mock::MockSpawner; production never calls it (the default real spawner runs whenever no per-thread spawner is installed).

Thread-local rather than global so parallel test execution is safe. Process-tool spawns happen on the test’s thread; the long-running waiter threads operate on the handle that was already returned, so they don’t perform spawner lookups themselves.