mirror of
https://github.com/rust-lang/rust
synced 2024-10-17 22:13:59 +00:00
sync::mpsc
: reload state after spinning on CAS failure
This commit is contained in:
parent
8c17a3e7cb
commit
7b721ed0cd
|
@ -167,9 +167,9 @@ fn start_send(&self, token: &mut Token) -> bool {
|
|||
token.array.stamp = tail + 1;
|
||||
return true;
|
||||
}
|
||||
Err(t) => {
|
||||
tail = t;
|
||||
Err(_) => {
|
||||
backoff.spin();
|
||||
tail = self.load(Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
} else if stamp.wrapping_add(self.one_lap) == tail + 1 {
|
||||
|
@ -251,8 +251,8 @@ fn start_recv(&self, token: &mut Token) -> bool {
|
|||
return true;
|
||||
}
|
||||
Err(h) => {
|
||||
head = h;
|
||||
backoff.spin();
|
||||
head = self.head.load(Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
} else if stamp == head {
|
||||
|
|
|
@ -246,10 +246,10 @@ fn start_send(&self, token: &mut Token) -> bool {
|
|||
token.list.offset = offset;
|
||||
return true;
|
||||
},
|
||||
Err(t) => {
|
||||
tail = t;
|
||||
block = self.tail.block.load(Ordering::Acquire);
|
||||
Err(_) => {
|
||||
backoff.spin();
|
||||
tail = self.tail.index.load(Ordering::Acquire);
|
||||
block = self.tail.block.load(Ordering::Acquire);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,9 +351,9 @@ fn start_recv(&self, token: &mut Token) -> bool {
|
|||
return true;
|
||||
},
|
||||
Err(h) => {
|
||||
head = h;
|
||||
block = self.head.block.load(Ordering::Acquire);
|
||||
backoff.spin();
|
||||
head = self.head.index.load(Ordering::Acquire);
|
||||
block = self.head.block.load(Ordering::Acquire);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue