pub struct ExecutorInner {
pub workers: Vec<Arc<Worker>>,
pub global_queue: Mutex<VecDeque<Arc<Task>>>,
pub tasks: Mutex<HashMap<TaskId, Arc<Task>>>,
pub next_task_id: AtomicU64,
pub running: AtomicBool,
pub shutdown: AtomicBool,
pub park_condvar: Condvar,
pub park_mutex: Mutex<()>,
pub active_workers: AtomicUsize,
}Expand description
Shared executor state.
Fields§
§workers: Vec<Arc<Worker>>All workers.
global_queue: Mutex<VecDeque<Arc<Task>>>Global task queue for overflow/new tasks.
tasks: Mutex<HashMap<TaskId, Arc<Task>>>All tasks by ID.
next_task_id: AtomicU64Next task ID.
running: AtomicBoolIs the executor running?
shutdown: AtomicBoolShutdown signal.
park_condvar: CondvarCondition variable for parking workers.
park_mutex: Mutex<()>Mutex for parking.
active_workers: AtomicUsizeNumber of active (non-parked) workers.
Implementations§
Source§impl ExecutorInner
impl ExecutorInner
Sourcepub fn wake_task(&self, task_id: TaskId)
pub fn wake_task(&self, task_id: TaskId)
Wake a task by ID, moving it to ready state and scheduling it.
Sourcepub fn alloc_task_id(&self) -> TaskId
pub fn alloc_task_id(&self) -> TaskId
Allocate a new task ID.
Sourcepub fn unpark_workers(&self)
pub fn unpark_workers(&self)
Unpark workers.
Auto Trait Implementations§
impl !Freeze for ExecutorInner
impl RefUnwindSafe for ExecutorInner
impl Send for ExecutorInner
impl Sync for ExecutorInner
impl Unpin for ExecutorInner
impl UnsafeUnpin for ExecutorInner
impl UnwindSafe for ExecutorInner
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