Skip to content

Commit 57855ff

Browse files
committed
f clearer comment, also dont bother spuriously waking
1 parent 6aefbe5 commit 57855ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/util/wakers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ impl Notifier {
9494
future_probably_generated_calls |= Arc::strong_count(&future_state) > 1;
9595
}
9696
if !future_probably_generated_calls {
97-
// If a future made some callbacks or still exists (i.e. the state has more than the
98-
// one reference we hold), assume the user was notified and skip the "classic"
99-
// waiters.
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.
100100
lock.0 = true;
101101
}
102102
mem::drop(lock);
103-
self.condvar.notify_all();
103+
if !future_probably_generated_calls { self.condvar.notify_all(); }
104104
}
105105

106106
/// Gets a [`Future`] that will get woken up with any waiters

0 commit comments

Comments
 (0)