diff --git a/src/lib.rs b/src/lib.rs index c446749..0cec374 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,7 +111,7 @@ use sync::Arc; #[cfg(not(loom))] use sync::WithMut; -use notify::{Internal, NotificationPrivate}; +use notify::NotificationPrivate; pub use notify::{IntoNotification, Notification}; /// Inner state of [`Event`]. @@ -437,21 +437,8 @@ impl Event { // Make sure the notification comes after whatever triggered it. notify.fence(notify::Internal::new()); - if let Some(inner) = self.try_inner() { - let limit = if notify.is_additional(Internal::new()) { - usize::MAX - } else { - notify.count(Internal::new()) - }; - - // Notify if there is at least one unnotified listener and the number of notified - // listeners is less than `limit`. - if inner.needs_notification(limit) { - return inner.notify(notify); - } - } - - 0 + let inner = unsafe { &*self.inner() }; + inner.notify(notify) } /// Return a reference to the inner state if it has been initialized. diff --git a/src/no_std.rs b/src/no_std.rs index 527fa9c..a6a2f25 100644 --- a/src/no_std.rs +++ b/src/no_std.rs @@ -45,11 +45,6 @@ impl crate::Inner { drop(self.try_lock()); } - pub(crate) fn needs_notification(&self, _limit: usize) -> bool { - // TODO: Figure out a stable way to do this optimization. - true - } - /// Add a new listener to the list. /// /// Does nothing if the list is already registered. diff --git a/src/std.rs b/src/std.rs index 0d39833..c509ebc 100644 --- a/src/std.rs +++ b/src/std.rs @@ -64,11 +64,6 @@ impl crate::Inner { } } - /// Whether or not this number of listeners would lead to a notification. - pub(crate) fn needs_notification(&self, limit: usize) -> bool { - self.notified.load(Ordering::Acquire) < limit - } - /// Add a new listener to the list. pub(crate) fn insert(&self, mut listener: Pin<&mut Option>>) { let mut inner = self.lock();