@@ -4,7 +4,6 @@ use std::fmt;
4
4
use std:: marker:: PhantomData ;
5
5
use std:: panic:: { RefUnwindSafe , UnwindSafe } ;
6
6
use std:: rc:: Rc ;
7
- use std:: sync:: atomic:: { AtomicBool , Ordering } ;
8
7
use std:: task:: { Poll , Waker } ;
9
8
10
9
use async_task:: { Builder , Runnable } ;
@@ -364,9 +363,6 @@ pub(crate) struct State {
364
363
/// The global queue.
365
364
pub ( crate ) queue : RefCell < VecDeque < Runnable > > ,
366
365
367
- /// Set to `true` when a sleeping ticker is notified or no tickers are sleeping.
368
- notified : AtomicBool ,
369
-
370
366
/// A list of sleeping tickers.
371
367
sleepers : RefCell < Sleepers > ,
372
368
@@ -379,7 +375,6 @@ impl State {
379
375
pub ( crate ) const fn new ( ) -> State {
380
376
State {
381
377
queue : RefCell :: new ( VecDeque :: new ( ) ) ,
382
- notified : AtomicBool :: new ( true ) ,
383
378
sleepers : RefCell :: new ( Sleepers {
384
379
count : 0 ,
385
380
wakers : Vec :: new ( ) ,
@@ -397,15 +392,9 @@ impl State {
397
392
/// Notifies a sleeping ticker.
398
393
#[ inline]
399
394
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 ( ) ;
409
398
}
410
399
}
411
400
@@ -505,11 +494,6 @@ impl Sleepers {
505
494
true
506
495
}
507
496
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
-
513
497
/// Returns notification waker for a sleeping ticker.
514
498
///
515
499
/// If a ticker was notified already or there are no tickers, `None` will be returned.
@@ -562,10 +546,6 @@ impl Ticker<'_> {
562
546
}
563
547
}
564
548
565
- self . state
566
- . notified
567
- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
568
-
569
549
true
570
550
}
571
551
@@ -574,10 +554,6 @@ impl Ticker<'_> {
574
554
if self . sleeping != 0 {
575
555
let mut sleepers = self . state . sleepers . borrow_mut ( ) ;
576
556
sleepers. remove ( self . sleeping ) ;
577
-
578
- self . state
579
- . notified
580
- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
581
557
}
582
558
self . sleeping = 0 ;
583
559
}
@@ -624,10 +600,6 @@ impl Drop for Ticker<'_> {
624
600
let mut sleepers = self . state . sleepers . borrow_mut ( ) ;
625
601
let notified = sleepers. remove ( self . sleeping ) ;
626
602
627
- self . state
628
- . notified
629
- . store ( sleepers. is_notified ( ) , Ordering :: Release ) ;
630
-
631
603
// If this ticker was notified, then notify another ticker.
632
604
if notified {
633
605
drop ( sleepers) ;
0 commit comments