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

Side by Side Diff: base/atomic_flag.cc

Issue 276002: Add AtomicFlag class to base/...... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/atomic_flag.h ('k') | base/atomic_flag_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/atomic_flag.h"
6
7 #include "base/dynamic_annotations.h"
8 #include "base/logging.h"
9
10 namespace base {
11
12 void AtomicFlag::Set() {
13 DCHECK(!flag_);
14 // Set() method can't be called if the flag has already been set.
15
16 ANNOTATE_HAPPENS_BEFORE(&flag_);
17 base::subtle::Release_Store(&flag_, 1);
18 }
19
20 bool AtomicFlag::IsSet() const {
21 bool ret = base::subtle::Acquire_Load(&flag_) != 0;
22 if (ret) {
23 ANNOTATE_HAPPENS_AFTER(&flag_);
24 }
25 return ret;
26 }
27
28 } // namespace base
OLDNEW
« no previous file with comments | « base/atomic_flag.h ('k') | base/atomic_flag_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698