master
WangRunji 7 years ago
parent bf46193c01
commit 646a88e4a6

@ -1,6 +1,6 @@
use alloc::{arc::Arc, arc::Weak, VecDeque}; use alloc::{arc::Arc, arc::Weak, VecDeque};
use super::Condvar; use super::Condvar;
use super::ThreadLock as Mutex; use super::SpinLock as Mutex;
struct Channel<T> { struct Channel<T> {
deque: Mutex<VecDeque<T>>, deque: Mutex<VecDeque<T>>,
@ -68,6 +68,7 @@ impl<T> Sender<T> {
Some(inner) => { Some(inner) => {
let mut deque = inner.deque.lock(); let mut deque = inner.deque.lock();
deque.push_back(t); deque.push_back(t);
inner.pushed.notify_one();
Ok(()) Ok(())
} }
} }
@ -135,7 +136,7 @@ pub mod test {
drop_full(); drop_full();
drop_full_shared(); drop_full_shared();
smoke_shared(); smoke_shared();
// smoke_threads(); // FIXME: deadlock smoke_threads();
smoke_port_gone(); smoke_port_gone();
println!("mpsc test end"); println!("mpsc test end");
} }

Loading…
Cancel
Save