mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
threadpool: update crossbeam dependencies (#874)
This commit is contained in:
committed by
Carl Lerche
parent
11e2af66a8
commit
e1a07ce50c
@@ -1,6 +1,7 @@
|
||||
use task::Queue;
|
||||
use task::Task;
|
||||
use worker;
|
||||
|
||||
use crossbeam_deque::Injector;
|
||||
use futures::{Future, Poll, Async};
|
||||
use futures::task::AtomicTask;
|
||||
|
||||
@@ -62,14 +63,17 @@ impl Future for Shutdown {
|
||||
pub(crate) struct ShutdownTrigger {
|
||||
inner: Arc<Mutex<Inner>>,
|
||||
workers: Arc<[worker::Entry]>,
|
||||
queue: Arc<Queue>,
|
||||
queue: Arc<Injector<Arc<Task>>>,
|
||||
}
|
||||
|
||||
unsafe impl Send for ShutdownTrigger {}
|
||||
unsafe impl Sync for ShutdownTrigger {}
|
||||
|
||||
impl ShutdownTrigger {
|
||||
pub(crate) fn new(workers: Arc<[worker::Entry]>, queue: Arc<Queue>) -> ShutdownTrigger {
|
||||
pub(crate) fn new(
|
||||
workers: Arc<[worker::Entry]>,
|
||||
queue: Arc<Injector<Arc<Task>>>,
|
||||
) -> ShutdownTrigger {
|
||||
ShutdownTrigger {
|
||||
inner: Arc::new(Mutex::new(Inner {
|
||||
task: AtomicTask::new(),
|
||||
@@ -84,7 +88,7 @@ impl ShutdownTrigger {
|
||||
impl Drop for ShutdownTrigger {
|
||||
fn drop(&mut self) {
|
||||
// Drain the global task queue.
|
||||
while self.queue.pop().is_some() {}
|
||||
while !self.queue.steal().is_empty() {}
|
||||
|
||||
// Drop the remaining incomplete tasks and parkers assosicated with workers.
|
||||
for worker in self.workers.iter() {
|
||||
|
||||
Reference in New Issue
Block a user