mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
feat: do not cause memory corruption if remove_from_list (safe function) is called multiple times
This commit is contained in:
parent
c3a5cf0a47
commit
08a0d7f53a
1 changed files with 4 additions and 0 deletions
|
|
@ -140,6 +140,10 @@ impl<T: Clone> Link<T> {
|
||||||
|
|
||||||
/// Remove this link from a linked list.
|
/// Remove this link from a linked list.
|
||||||
pub fn remove_from_list(&self, list: &DoublyLinkedList<T>) {
|
pub fn remove_from_list(&self, list: &DoublyLinkedList<T>) {
|
||||||
|
if self.is_popped() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cs::with(|_| {
|
cs::with(|_| {
|
||||||
// Make sure all previous writes are visible
|
// Make sure all previous writes are visible
|
||||||
core::sync::atomic::fence(Ordering::SeqCst);
|
core::sync::atomic::fence(Ordering::SeqCst);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue