@@ -4,7 +4,6 @@ use std::fmt;
44use std:: marker:: PhantomData ;
55use std:: panic:: { RefUnwindSafe , UnwindSafe } ;
66use std:: rc:: Rc ;
7- use std:: sync:: atomic:: { AtomicBool , Ordering } ;
87use std:: task:: { Poll , Waker } ;
98
109use async_task:: { Builder , Runnable } ;
@@ -364,9 +363,6 @@ pub(crate) struct State {
364363 /// The global queue.
365364 pub ( crate ) queue : RefCell < VecDeque < Runnable > > ,
366365
367- /// Set to `true` when a sleeping ticker is notified or no tickers are sleeping.
368- notified : AtomicBool ,
369-
370366 /// A list of sleeping tickers.
371367 sleepers : RefCell < Sleepers > ,
372368
@@ -379,7 +375,6 @@ impl State {
379375 pub ( crate ) const fn new ( ) -> State {
380376 State {
381377 queue : RefCell :: new ( VecDeque :: new ( ) ) ,
382- notified : AtomicBool :: new ( true ) ,
383378 sleepers : RefCell :: new ( Sleepers {
384379 count : 0 ,
385380 wakers : Vec :: new ( ) ,
@@ -397,15 +392,9 @@ impl State {
397392 /// Notifies a sleeping ticker.
398393 #[ inline]
399394 fn notify ( & self ) {
400- if self
401- . notified
402- . compare_exchange ( false , true , Ordering :: AcqRel , Ordering :: Acquire )
403- . is_ok ( )
404- {
405- let waker = self . sleepers . borrow_mut ( ) . notify ( ) ;
406- if let Some ( w) = waker {
407- w. wake ( ) ;
408- }
395+ let waker = self . sleepers . borrow_mut ( ) . notify ( ) ;
396+ if let Some ( w) = waker {
397+ w. wake ( ) ;
409398 }
410399 }
411400
@@ -505,11 +494,6 @@ impl Sleepers {
505494 true
506495 }
507496
508- /// Returns `true` if a sleeping ticker is notified or no tickers are sleeping.
509- fn is_notified ( & self ) -> bool {
510- self . count == 0 || self . count > self . wakers . len ( )
511- }
512-
513497 /// Returns notification waker for a sleeping ticker.
514498 ///
515499 /// If a ticker was notified already or there are no tickers, `None` will be returned.
@@ -562,10 +546,6 @@ impl Ticker<'_> {
562546 }
563547 }
564548
565- self . state
566- . notified
567- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
568-
569549 true
570550 }
571551
@@ -574,10 +554,6 @@ impl Ticker<'_> {
574554 if self . sleeping != 0 {
575555 let mut sleepers = self . state . sleepers . borrow_mut ( ) ;
576556 sleepers. remove ( self . sleeping ) ;
577-
578- self . state
579- . notified
580- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
581557 }
582558 self . sleeping = 0 ;
583559 }
@@ -624,10 +600,6 @@ impl Drop for Ticker<'_> {
624600 let mut sleepers = self . state . sleepers . borrow_mut ( ) ;
625601 let notified = sleepers. remove ( self . sleeping ) ;
626602
627- self . state
628- . notified
629- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
630-
631603 // If this ticker was notified, then notify another ticker.
632604 if notified {
633605 drop ( sleepers) ;
0 commit comments