http_type/task/struct.rs
1use super::*;
2
3/// Task manager for handling async tasks across worker threads.
4///
5/// This structure manages a pool of task senders distributed across
6/// multiple worker threads, enabling efficient round-robin task scheduling
7/// with event-driven wake-up mechanism.
8#[derive(Clone, CustomDebug, Data, DisplayDebug)]
9pub struct Task {
10 /// Pool of unbounded senders for distributing tasks to worker threads.
11 pub pool: Vec<UnboundedSender<AsyncTask>>,
12 /// Atomic counter for round-robin task distribution across workers.
13 pub counter: Arc<AtomicUsize>,
14 /// Flag indicating whether the task pool should shut down.
15 pub shutdown: Arc<AtomicBool>,
16 /// Notification handles for precise wake-up of specific workers.
17 pub notifies: Vec<Arc<Notify>>,
18}