diff options
Diffstat (limited to 'absl/synchronization/notification.h')
-rw-r--r-- | absl/synchronization/notification.h | 9 |
1 files changed, 8 insertions, 1 deletions
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_ }; |