Skip to content

Commit

Permalink
add queue_statistics to ThreadPool
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
  • Loading branch information
sticnarf committed Jan 6, 2020
1 parent 7bb2f8f commit 50f4037
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use self::builder::{Builder, SchedConfig};
pub use self::runner::{CloneRunnerBuilder, Runner, RunnerBuilder};
pub use self::spawn::{build_spawn, Local, Remote};

use crate::queue::{TaskCell, WithExtras};
use crate::queue::{QueueStatistics, TaskCell, WithExtras};
use std::mem;
use std::sync::Mutex;
use std::thread::JoinHandle;
Expand Down Expand Up @@ -48,6 +48,11 @@ impl<T: TaskCell + Send> ThreadPool<T> {
pub fn remote(&self) -> &Remote<T> {
&self.remote
}

/// Gets the task queue statistics of the thread pool.
pub fn queue_statistics(&self) -> QueueStatistics {
self.remote.queue_statistics()
}
}

impl<T: TaskCell + Send> Drop for ThreadPool<T> {
Expand Down

0 comments on commit 50f4037

Please sign in to comment.