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

Function managed_worker

src/thread_pool.rs:2510–2519  ·  view source on GitHub ↗

This is the main loop for a worker thread. It's in charge of executing jobs. Operating on the principle that you should finish what you start before starting something new, workers will first execute their queue, then execute shared jobs, then pull new jobs from the injector.

(membership: Membership, halt: Arc<AtomicBool>)

Source from the content-addressed store, hash-verified

2508 }
2509}
2510
2511// -----------------------------------------------------------------------------
2512// Implicit worker registration api
2513
2514/// A [`ThreadPool`] wrapper, used by the [`DEFAULT_POOL`].
2515///
2516/// This dereferences to a [`ThreadPool`]. The first time it is dereferenced, it
2517/// resizes itself to fill all available cores.
2518pub struct DefaultThreadPool {
2519 thread_pool: &'static ThreadPool,
2520 initialized: AtomicU32,
2521}
2522

Callers 1

resizeMethod · 0.85

Calls 3

activateMethod · 0.80
yield_nowMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected