mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-22 16:16:16 +04:00
Fix mpsc
This commit is contained in:
parent
bf46193c01
commit
646a88e4a6
@ -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<T> {
|
||||
deque: Mutex<VecDeque<T>>,
|
||||
@ -68,6 +68,7 @@ impl<T> Sender<T> {
|
||||
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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user