File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -93,14 +93,16 @@ impl Notifier {
9393 future_probably_generated_calls |= future_state. lock ( ) . unwrap ( ) . complete ( ) ;
9494 future_probably_generated_calls |= Arc :: strong_count ( & future_state) > 1 ;
9595 }
96- if !future_probably_generated_calls {
97- // If no future made any callbacks and has been drop'd (i.e. the state has only the one
98- // reference we hold), assume the user was not notified and set the
99- // notification-required flag. This will cause the `wait` functions above to return.
100- lock. 0 = true ;
96+ if future_probably_generated_calls {
97+ // If a future made some callbacks or has not yet been drop'd (i.e. the state has more
98+ // than the one reference we hold), assume the user was notified and skip setting the
99+ // notification-required flag. This will not cause the `wait` functions above to return
100+ // and avoid any future `Future`s starting in a completed state.
101+ return ;
101102 }
103+ lock. 0 = true ;
102104 mem:: drop ( lock) ;
103- if !future_probably_generated_calls { self . condvar . notify_all ( ) ; }
105+ self . condvar . notify_all ( ) ;
104106 }
105107
106108 /// Gets a [`Future`] that will get woken up with any waiters
You can’t perform that action at this time.
0 commit comments