File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -447,8 +447,8 @@ mod tests {
447
447
448
448
// If we get a future and don't touch it we're definitely still notify-required.
449
449
notifier. get_future ( ) ;
450
- assert ! ( notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
451
- assert ! ( !notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
450
+ assert ! ( notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
451
+ assert ! ( !notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
452
452
453
453
// Even if we poll'd once but didn't observe a `Ready`, we should be notify-required.
454
454
let mut future = notifier. get_future ( ) ;
@@ -457,10 +457,16 @@ mod tests {
457
457
458
458
notifier. notify ( ) ;
459
459
assert ! ( woken. load( Ordering :: SeqCst ) ) ;
460
- assert ! ( notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
460
+ assert ! ( notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
461
461
462
- notifier. notify ( ) ;
462
+ // However, once we do poll `Ready` it should wipe the notify-required flag.
463
+ let mut future = notifier. get_future ( ) ;
464
+ let ( woken, waker) = create_waker ( ) ;
465
+ assert_eq ! ( Pin :: new( & mut future) . poll( & mut Context :: from_waker( & waker) ) , Poll :: Pending ) ;
463
466
464
467
notifier. notify ( ) ;
468
+ assert ! ( woken. load( Ordering :: SeqCst ) ) ;
469
+ assert_eq ! ( Pin :: new( & mut future) . poll( & mut Context :: from_waker( & waker) ) , Poll :: Ready ( ( ) ) ) ;
470
+ assert ! ( !notifier. wait_timeout( Duration :: from_millis( 1 ) ) ) ;
465
471
}
466
472
}
You can’t perform that action at this time.
0 commit comments