mirror of https://github.com/smol-rs/polling
Replace deprecated compare_and_swap with compare_exchange
This commit is contained in:
parent
14c8d34655
commit
c009653b99
|
@ -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()?;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue