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

Unified Diff: base/synchronization/atomic_flag.cc

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 | « base/synchronization/atomic_flag.h ('k') | base/synchronization/atomic_flag_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/atomic_flag.cc
diff --git a/base/synchronization/atomic_flag.cc b/base/synchronization/atomic_flag.cc
index 98d90cb88fd6c039842eb6ac5ccd6bd6017abf9f..8c2018d369324bb4ea64b8cf4ccabe989a3eab71 100644
--- a/base/synchronization/atomic_flag.cc
+++ b/base/synchronization/atomic_flag.cc
@@ -8,10 +8,16 @@
namespace base {
-AtomicFlag::AtomicFlag() = default;
+AtomicFlag::AtomicFlag() {
+ // It doesn't matter where the AtomicFlag is built so long as it's always
+ // Set() from the same sequence after. Note: the sequencing requirements are
+ // necessary for IsSet()'s callers to know which sequence's memory operations
+ // they are synchronized with.
+ set_sequence_checker_.DetachFromSequence();
+}
void AtomicFlag::Set() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(set_sequence_checker_.CalledOnValidSequence());
base::subtle::Release_Store(&flag_, 1);
}
« no previous file with comments | « base/synchronization/atomic_flag.h ('k') | base/synchronization/atomic_flag_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698