pub struct MainThreadPump { /* private fields */ }Expand description
Cooperative pump that drains main-thread work items on demand.
MainThreadPump is Clone — all clones share the same underlying queue.
The instance that calls pump must be on the affinity thread.
§Thread safety
dispatch is safe to call from any thread.
pump must be called from the thread that “owns” the pump
(typically the DCC main / UI thread).
Implementations§
Source§impl MainThreadPump
impl MainThreadPump
Sourcepub fn pump(&self, budget: Duration) -> PumpStats
pub fn pump(&self, budget: Duration) -> PumpStats
Drain pending work items for up to budget wall-clock time.
Call this from the host’s idle / update callback. The pump will process as many items as possible within the budget without over-running it (each item runs to completion; the budget is checked between items).
Returns PumpStats describing what happened.
Sourcepub fn total_dispatched(&self) -> u64
pub fn total_dispatched(&self) -> u64
Total number of closures ever dispatched since this pump was created.
Sourcepub fn total_processed(&self) -> u64
pub fn total_processed(&self) -> u64
Total number of closures ever processed since this pump was created.
Trait Implementations§
Source§impl Clone for MainThreadPump
impl Clone for MainThreadPump
Source§fn clone(&self) -> MainThreadPump
fn clone(&self) -> MainThreadPump
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more