Skip to main content

Module background

Module background 

Source
Expand description

Background work and timers, provided by the host.

A toolkit service that must not block a frame (image decoding, transport calls, periodic refreshes) hands its work to a Background rather than spawning threads or sleeping. The host decides how it runs: ThreadPool when no executor is entered, Pumped for deterministic tests and hosts that drive work from their own loop, the page’s own executor in a browser, or any other Executor installed with Background::enter.

The executor is captured when a service is constructed, so enter it around construction. An executor may refuse work with Unsupported: callers degrade instead of retrying forever.

Structs§

Background
BackgroundGuard
NoBackground
An executor that refuses all background work, for hosts that have none. Timers still fire, on park, so deadline-driven callers in a synchronous driver make progress.
Pumped
An executor that runs nothing until its owner pumps it.
ThreadPool
Unsupported

Traits§

Executor

Type Aliases§

Job