Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: base/synchronization/atomic_flag.h

Issue 2187333002: Loosen/improve AtomicFlag semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile post merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/synchronization/atomic_flag.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/atomic_flag.h
diff --git a/base/synchronization/atomic_flag.h b/base/synchronization/atomic_flag.h
index c754e8729c87769098ba1c54ef6447a340555a05..ff175e190c52f2dc5ac6e54bf9a88ffad92856e7 100644
--- a/base/synchronization/atomic_flag.h
+++ b/base/synchronization/atomic_flag.h
@@ -8,7 +8,7 @@
#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/macros.h"
-#include "base/threading/thread_checker.h"
+#include "base/sequence_checker.h"
namespace base {
@@ -20,10 +20,12 @@ class BASE_EXPORT AtomicFlag {
AtomicFlag();
~AtomicFlag() = default;
- // Set the flag. May only be called on the thread which created the object.
+ // Set the flag. Must always be called from the same sequence.
void Set();
- // Returns true iff the flag was set.
+ // Returns true iff the flag was set. If this returns true, the current thread
+ // is guaranteed to be synchronized with all memory operations on the sequence
+ // which invoked Set() up until at least the first call to Set() on it.
bool IsSet() const;
// Resets the flag. Be careful when using this: callers might not expect
@@ -32,7 +34,7 @@ class BASE_EXPORT AtomicFlag {
private:
base::subtle::Atomic32 flag_ = 0;
- ThreadChecker thread_checker_;
+ SequenceChecker set_sequence_checker_;
DISALLOW_COPY_AND_ASSIGN(AtomicFlag);
};
« no previous file with comments | « no previous file | base/synchronization/atomic_flag.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698