struct ThreadPoolInner {
job_count: Mutex<usize>,
empty_condvar: Condvar,
}
Expand description
Internal data structure for tracking the current job status. This is shared by worker closures
via Arc
so that the workers can report to the pool that it started/finished a job.
Fields§
§job_count: Mutex<usize>
§empty_condvar: Condvar
Implementations§
Source§impl ThreadPoolInner
impl ThreadPoolInner
Sourcefn finish_job(&self)
fn finish_job(&self)
Decrement the job count.
Sourcefn wait_empty(&self)
fn wait_empty(&self)
Wait until the job count becomes 0.
NOTE: We can optimize this function by adding another field to ThreadPoolInner
, but let’s
not care about that in this homework.
Trait Implementations§
Source§impl Debug for ThreadPoolInner
impl Debug for ThreadPoolInner
Source§impl Default for ThreadPoolInner
impl Default for ThreadPoolInner
Source§fn default() -> ThreadPoolInner
fn default() -> ThreadPoolInner
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ThreadPoolInner
impl RefUnwindSafe for ThreadPoolInner
impl Send for ThreadPoolInner
impl Sync for ThreadPoolInner
impl Unpin for ThreadPoolInner
impl UnwindSafe for ThreadPoolInner
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