From 646a88e4a6d7b5642a0fa3b448dab47b0ed1e663 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Tue, 5 Jun 2018 13:38:45 +0800 Subject: [PATCH] Fix mpsc --- src/sync/mpsc.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sync/mpsc.rs b/src/sync/mpsc.rs index 8700025..1878794 100644 --- a/src/sync/mpsc.rs +++ b/src/sync/mpsc.rs @@ -1,6 +1,6 @@ use alloc::{arc::Arc, arc::Weak, VecDeque}; use super::Condvar; -use super::ThreadLock as Mutex; +use super::SpinLock as Mutex; struct Channel { deque: Mutex>, @@ -68,6 +68,7 @@ impl Sender { Some(inner) => { let mut deque = inner.deque.lock(); deque.push_back(t); + inner.pushed.notify_one(); Ok(()) } } @@ -135,7 +136,7 @@ pub mod test { drop_full(); drop_full_shared(); smoke_shared(); -// smoke_threads(); // FIXME: deadlock + smoke_threads(); smoke_port_gone(); println!("mpsc test end"); }