Skip to content

Commit 4e32cca

Browse files
authored
Merge pull request #28 from taiki-e/compare_and_swap
Replace deprecated compare_and_swap with compare_exchange
2 parents 14c8d34 + c009653 commit 4e32cca

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,10 @@ impl Poller {
421421
/// ```
422422
pub fn notify(&self) -> io::Result<()> {
423423
log::trace!("Poller::notify()");
424-
if !self
424+
if self
425425
.notified
426-
.compare_and_swap(false, true, Ordering::SeqCst)
426+
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
427+
.is_ok()
427428
{
428429
self.poller.notify()?;
429430
}

src/wepoll.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ impl Poller {
115115
pub fn notify(&self) -> io::Result<()> {
116116
log::trace!("notify: handle={:?}", self.handle);
117117

118-
if !self
118+
if self
119119
.notified
120-
.compare_and_swap(false, true, Ordering::SeqCst)
120+
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
121+
.is_ok()
121122
{
122123
unsafe {
123124
// This call errors if a notification has already been posted, but that's okay - we

0 commit comments

Comments
 (0)