pub struct ThreadPerHostSched<HostType: Host> { /* private fields */ }
Expand description
A host scheduler.
Implementations§
source§impl<HostType: Host> ThreadPerHostSched<HostType>
impl<HostType: Host> ThreadPerHostSched<HostType>
sourcepub fn new<T>(
cpu_ids: &[Option<u32>],
host_storage: &'static LocalKey<RefCell<Option<HostType>>>,
hosts: T,
) -> Selfwhere
T: IntoIterator<Item = HostType, IntoIter: ExactSizeIterator>,
pub fn new<T>(
cpu_ids: &[Option<u32>],
host_storage: &'static LocalKey<RefCell<Option<HostType>>>,
hosts: T,
) -> Selfwhere
T: IntoIterator<Item = HostType, IntoIter: ExactSizeIterator>,
A new host scheduler with logical processors that are pinned to the provided OS processors.
Each logical processor is assigned many threads, and each thread is given a single host. The
number of threads created will be the length of hosts
.
An empty host_storage
for thread-local storage is required for each thread to have
efficient access to its host. A panic may occur if host_storage
is not None
, or if it is
borrowed while the scheduler is in use.
sourcepub fn parallelism(&self) -> usize
pub fn parallelism(&self) -> usize
sourcepub fn scope<'scope>(
&'scope mut self,
f: impl for<'a> FnOnce(SchedulerScope<'a, 'scope, HostType>) + 'scope,
)
pub fn scope<'scope>( &'scope mut self, f: impl for<'a> FnOnce(SchedulerScope<'a, 'scope, HostType>) + 'scope, )
Auto Trait Implementations§
impl<HostType> Freeze for ThreadPerHostSched<HostType>
impl<HostType> !RefUnwindSafe for ThreadPerHostSched<HostType>
impl<HostType> Send for ThreadPerHostSched<HostType>
impl<HostType> Sync for ThreadPerHostSched<HostType>
impl<HostType> Unpin for ThreadPerHostSched<HostType>
impl<HostType> !UnwindSafe for ThreadPerHostSched<HostType>
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