pub struct ThreadpoolRuntime { /* private fields */ }Available on crate feature
std only.Expand description
A running threadpool with priority lanes (RT-CORBA §5.7).
Implementations§
Source§impl ThreadpoolRuntime
impl ThreadpoolRuntime
Sourcepub fn start<M: PriorityMapping>(
pool: &Threadpool,
mapping: &M,
hook: Option<Arc<dyn NativePrioritySetter>>,
) -> Self
pub fn start<M: PriorityMapping>( pool: &Threadpool, mapping: &M, hook: Option<Arc<dyn NativePrioritySetter>>, ) -> Self
Starts a threadpool: creates static_threads workers per lane.
mapping maps the lane priority to the native priority that is
passed to the hook (if set) per worker.
Sourcepub fn dispatch<F>(
&self,
priority: Priority,
job: F,
) -> Result<(), DispatchError>
pub fn dispatch<F>( &self, priority: Priority, job: F, ) -> Result<(), DispatchError>
Hands a job to the lane of its priority. Wakes a waiting worker or creates — under saturation with free dynamic budget — a dynamic worker.
§Errors
DispatchError::NoLane on an empty pool; DispatchError::Rejected
if no worker is free and buffering is off or the buffer is full.
Sourcepub fn lane_count(&self) -> usize
pub fn lane_count(&self) -> usize
Number of lanes.
Sourcepub fn spawned_workers(&self, lane_index: usize) -> usize
pub fn spawned_workers(&self, lane_index: usize) -> usize
Number of currently alive workers of a lane (static + dynamic), derived from the stored handles. Primarily for tests/telemetry.
§Panics
On a poisoned internal lock.
Trait Implementations§
Source§impl Drop for ThreadpoolRuntime
impl Drop for ThreadpoolRuntime
Auto Trait Implementations§
impl !RefUnwindSafe for ThreadpoolRuntime
impl !UnwindSafe for ThreadpoolRuntime
impl Freeze for ThreadpoolRuntime
impl Send for ThreadpoolRuntime
impl Sync for ThreadpoolRuntime
impl Unpin for ThreadpoolRuntime
impl UnsafeUnpin for ThreadpoolRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more