Skip to content

Commit db5b0f3

Browse files
committed
Make Notifier pub to allow it being used outside of lightning
1 parent 3a3cbef commit db5b0f3

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
@@ -30,17 +30,18 @@ use core::pin::Pin;
3030
use core::task::{Context, Poll};
3131

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

3737
impl Notifier {
38-
pub(crate) fn new() -> Self {
38+
/// Constructs a new notifier.
39+
pub fn new() -> Self {
3940
Self { notify_pending: Mutex::new((false, None)) }
4041
}
4142

4243
/// Wake waiters, tracking that wake needs to occur even if there are currently no waiters.
43-
pub(crate) fn notify(&self) {
44+
pub fn notify(&self) {
4445
let mut lock = self.notify_pending.lock().unwrap();
4546
if let Some(future_state) = &lock.1 {
4647
if complete_future(future_state) {
@@ -52,7 +53,7 @@ impl Notifier {
5253
}
5354

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

0 commit comments

Comments
 (0)