forked from M-Labs/zynq-rs
Compare commits
11 Commits
91daf8a13f
...
7375b5188b
Author | SHA1 | Date |
---|---|---|
Simon Renblad | 7375b5188b | |
Simon Renblad | c2e5699ef7 | |
Simon Renblad | 8e571da51a | |
Simon Renblad | fd8c4b9744 | |
Simon Renblad | 817185d319 | |
Simon Renblad | d755ae8480 | |
Simon Renblad | de5c2b42b4 | |
Simon Renblad | 62be53d88b | |
Simon Renblad | 07bfd5df06 | |
Simon Renblad | a7eead0074 | |
Simon Renblad | 907edf2752 |
|
@ -37,7 +37,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
|
||||||
notify_spin_lock();
|
notify_spin_lock();
|
||||||
if !prev.is_null() {
|
if !prev.is_null() {
|
||||||
unsafe {
|
unsafe {
|
||||||
Box::from_raw(prev);
|
let _ = Box::from_raw(prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -91,7 +91,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
|
||||||
for v in self.list.iter() {
|
for v in self.list.iter() {
|
||||||
let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed);
|
let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed);
|
||||||
if !original.is_null() {
|
if !original.is_null() {
|
||||||
Box::from_raw(original);
|
let _ = Box::from_raw(original);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,8 @@ macro_rules! sync_channel {
|
||||||
{
|
{
|
||||||
use core::sync::atomic::{AtomicUsize, AtomicPtr};
|
use core::sync::atomic::{AtomicUsize, AtomicPtr};
|
||||||
use $crate::sync_channel::{Sender, Receiver};
|
use $crate::sync_channel::{Sender, Receiver};
|
||||||
static LIST: [AtomicPtr<$t>; $cap + 1] = [const { AtomicPtr::new(core::ptr::null_mut()); }; $cap + 1];
|
const cnst_ptr: AtomicPtr<$t> = AtomicPtr::new(core::ptr::null_mut());
|
||||||
|
static LIST: [AtomicPtr<$t>; $cap + 1] = [cnst_ptr; $cap + 1];
|
||||||
static WRITE: AtomicUsize = AtomicUsize::new(0);
|
static WRITE: AtomicUsize = AtomicUsize::new(0);
|
||||||
static READ: AtomicUsize = AtomicUsize::new(0);
|
static READ: AtomicUsize = AtomicUsize::new(0);
|
||||||
(Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))
|
(Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))
|
||||||
|
|
Loading…
Reference in New Issue