Skip to content

Commit cd767a3

Browse files
committed
Make Notifier pub to allow it being used outside of lightning
1 parent 0371231 commit cd767a3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lightning/src/util/wakers.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,20 @@ use core::pin::Pin;
3131

3232

3333
/// Used to signal to one of many waiters that the condition they're waiting on has happened.
34-
pub(crate) struct Notifier {
34+
pub struct Notifier {
3535
notify_pending: Mutex<(bool, Option<Arc<Mutex<FutureState>>>)>,
3636
}
3737

3838
impl Notifier {
39-
pub(crate) fn new() -> Self {
39+
/// Constructs a new notifier.
40+
pub fn new() -> Self {
4041
Self {
4142
notify_pending: Mutex::new((false, None)),
4243
}
4344
}
4445

4546
/// Wake waiters, tracking that wake needs to occur even if there are currently no waiters.
46-
pub(crate) fn notify(&self) {
47+
pub fn notify(&self) {
4748
let mut lock = self.notify_pending.lock().unwrap();
4849
if let Some(future_state) = &lock.1 {
4950
if complete_future(future_state) {
@@ -55,7 +56,7 @@ impl Notifier {
5556
}
5657

5758
/// Gets a [`Future`] that will get woken up with any waiters
58-
pub(crate) fn get_future(&self) -> Future {
59+
pub fn get_future(&self) -> Future {
5960
let mut lock = self.notify_pending.lock().unwrap();
6061
let mut self_idx = 0;
6162
if let Some(existing_state) = &lock.1 {

0 commit comments

Comments
 (0)