diff options
Diffstat (limited to 'absl/synchronization')
-rw-r--r-- | absl/synchronization/notification.cc | 9 | ||||
-rw-r--r-- | absl/synchronization/notification.h | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/absl/synchronization/notification.cc b/absl/synchronization/notification.cc index 53ace00870c9..1eb7f4161905 100644 --- a/absl/synchronization/notification.cc +++ b/absl/synchronization/notification.cc @@ -44,15 +44,6 @@ Notification::~Notification() { MutexLock l(&this->mutex_); } -static inline bool HasBeenNotifiedInternal( - const std::atomic<bool> *notified_yet) { - return notified_yet->load(std::memory_order_acquire); -} - -bool Notification::HasBeenNotified() const { - return HasBeenNotifiedInternal(&this->notified_yet_); -} - void Notification::WaitForNotification() const { if (!HasBeenNotifiedInternal(&this->notified_yet_)) { this->mutex_.LockWhen(Condition(&HasBeenNotifiedInternal, diff --git a/absl/synchronization/notification.h b/absl/synchronization/notification.h index 82d111a5492f..36c2ce3dcefd 100644 --- a/absl/synchronization/notification.h +++ b/absl/synchronization/notification.h @@ -73,7 +73,9 @@ class Notification { // Notification::HasBeenNotified() // // Returns the value of the notification's internal "notified" state. - bool HasBeenNotified() const; + bool HasBeenNotified() const { + return HasBeenNotifiedInternal(&this->notified_yet_); + } // Notification::WaitForNotification() // @@ -105,6 +107,11 @@ class Notification { void Notify(); private: + static inline bool HasBeenNotifiedInternal( + const std::atomic<bool>* notified_yet) { + return notified_yet->load(std::memory_order_acquire); + } + mutable Mutex mutex_; std::atomic<bool> notified_yet_; // written under mutex_ }; |