Skip to content

Commit

Permalink
Merge pull request #28 from taiki-e/compare_and_swap
Browse files Browse the repository at this point in the history
Replace deprecated compare_and_swap with compare_exchange
  • Loading branch information
taiki-e authored Dec 24, 2020
2 parents 14c8d34 + c009653 commit 4e32cca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
}
Expand Down
5 changes: 3 additions & 2 deletions src/wepoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e32cca

Please sign in to comment.