Replace deprecated compare_and_swap with compare_exchange

This commit is contained in:
Taiki Endo 2020-12-24 21:18:55 +09:00
parent 14c8d34655
commit c009653b99
2 changed files with 6 additions and 4 deletions

View File

@ -421,9 +421,10 @@ impl Poller {
/// ```
pub fn notify(&self) -> io::Result<()> {
log::trace!("Poller::notify()");
if !self
if self
.notified
.compare_and_swap(false, true, Ordering::SeqCst)
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
self.poller.notify()?;
}

View File

@ -115,9 +115,10 @@ impl Poller {
pub fn notify(&self) -> io::Result<()> {
log::trace!("notify: handle={:?}", self.handle);
if !self
if self
.notified
.compare_and_swap(false, true, Ordering::SeqCst)
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
unsafe {
// This call errors if a notification has already been posted, but that's okay - we