diff --git a/src/lib.rs b/src/lib.rs index 6fac139..3dddbe2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,7 +165,7 @@ struct Inner { /// The number of notified entries, or `usize::MAX` if all of them have been notified. /// /// If there are no entries, this value is set to `usize::MAX`. - pub(crate) notified: AtomicUsize, + notified: AtomicUsize, /// Inner queue of event listeners. list: list::List, @@ -179,14 +179,6 @@ impl Inner { list: list::List::new(), } } - - /// Locks the list. - pub(crate) fn lock(&self) -> Option> { - self.list.inner.try_lock().map(|guard| list::ListGuard { - inner: self, - guard: Some(guard), - }) - } } /// A synchronization primitive for notifying async tasks and threads. diff --git a/src/list.rs b/src/list.rs index 96b416b..5813608 100644 --- a/src/list.rs +++ b/src/list.rs @@ -14,6 +14,14 @@ use core::ops; use slab::Slab; impl crate::Inner { + /// Locks the list. + fn lock(&self) -> Option> { + self.list.inner.try_lock().map(|guard| ListGuard { + inner: self, + guard: Some(guard), + }) + } + /// Add a new listener to the list. /// /// Does nothing if the list is already registered.