libcortex_a9/sync_channel: added drop_elements function.
This commit is contained in:
parent
a36a82d86d
commit
3958953ceb
@ -200,6 +200,9 @@ pub fn main_core0() {
|
|||||||
println!("{} -> {}", i, j);
|
println!("{} -> {}", i, j);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
unsafe {
|
||||||
|
core1_req.drop_elements();
|
||||||
|
}
|
||||||
|
|
||||||
let eth = zynq::eth::Eth::default(HWADDR.clone());
|
let eth = zynq::eth::Eth::default(HWADDR.clone());
|
||||||
println!("Eth on");
|
println!("Eth on");
|
||||||
|
@ -86,6 +86,17 @@ impl<'a, T> Sender<'a, T> where T: Clone {
|
|||||||
}.await
|
}.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// free all items in the queue. It is the user's responsibility to
|
||||||
|
/// ensure no reader is trying to copy the data.
|
||||||
|
pub unsafe fn drop_elements(&mut self) {
|
||||||
|
for v in self.list.iter() {
|
||||||
|
let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed);
|
||||||
|
if !original.is_null() {
|
||||||
|
drop_in_place(original);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Reset the `sync_channel`, *forget* all items in the queue. Affects both the sender and
|
/// Reset the `sync_channel`, *forget* all items in the queue. Affects both the sender and
|
||||||
/// receiver.
|
/// receiver.
|
||||||
pub unsafe fn reset(&mut self) {
|
pub unsafe fn reset(&mut self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user