MCPcopy Create free account
hub / github.com/NthTensor/Forte / spawn_local

Method spawn_local

src/thread_pool.rs:1601–1620  ·  view source on GitHub ↗
(&self, work: S)

Source from the content-addressed store, hash-verified

1599 Err(StealError::Empty) => break,
1600 }
1601 }
1602 }
1603 None
1604 }
1605
1606 /// Cooperatively yields execution to the thread pool, allowing it to execute
1607 /// some work.
1608 ///
1609 /// This function will only execute work already held locally by the worker,
1610 /// and does no synchronization. To claim and run shared work, use
1611 /// [`yield_now`][Worker::yield_now].
1612 ///
1613 /// If no work is found, this returns `Yield::Idle`. This function should
1614 /// not be called again (for at least a few microseconds) after an idle.
1615 /// Calling this repeatedly in a spin-loop should be avoided, as it's likely
1616 /// to significantly spike CPU usage and waste resources.
1617 #[inline(always)]
1618 pub fn yield_local(&self) -> Yield {
1619 // We use LIFO order here, pulling the newest work from the queue. This
1620 // is just for consistency with yield_now/find_work.
1621 match self.find_local_work() {
1622 Some(job_ref) => {
1623 self.execute(job_ref, false);

Callers

nothing calls this directly

Calls 2

signalMethod · 0.80
spawnMethod · 0.45

Tested by

no test coverage detected