Skip to content

Commit 2004451

Browse files
committed
f lol duh
1 parent 57855ff commit 2004451

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lightning/src/util/wakers.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)