Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub struct Queue
- {
- data: std::collections::VecDeque<u8>,
- }
- impl Queue
- {
- pub fn push(&mut self, val: u8)
- {
- self.data.push_back(val);
- }
- pub fn pop(&mut self)
- {
- if !self.data.is_empty()
- {
- self.data.pop_front();
- }
- }
- pub fn front(&self) -> u8
- {
- *self.data.front().unwrap()
- }
- }
- fn processing(i_b: &mut Arc<RefCell<Queue>>, o_b: &mut Arc<RefCell<Queue>>)
- {
- i_b.get_mut().pop();
- print!("{}, {} : ", i_b.get_mut().front(), o_b.get_mut().front());
- }
- error[E0277]: `std::cell::RefCell<Queue>` cannot be shared between threads safely
- --> srcmain.rs:69:14
- |
- 69 | let _c = thread::spawn(move || {
- | ^^^^^^^^^^^^^ `std::cell::RefCell<Queue>` cannot be shared between threads safely
- |
- = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<Queue>`
- = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<std::cell::RefCell<Queue>>`
- = note: required because it appears within the type `[closure@srcmain.rs:69:28: 71:6 _a:std::sync::Arc<std::cell::RefCell<Queue>>, _b:std::sync::Arc<std::cell::RefCell<Queue>>]`
- = note: required by `std::thread::spawn`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement