summaryrefslogtreecommitdiffstats
path: root/base/cancellation_flag.cc
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 21:11:34 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 21:11:34 +0000
commitbaeb22f54fafa2b8394a7ccd74536ed7ccc23c34 (patch)
treeb5bfb16f735a2fe506b9aecf7dd0b8dead9c7dc8 /base/cancellation_flag.cc
parent36f5c5604d898b06763e0104980300c788e4ea48 (diff)
downloadchromium_src-baeb22f54fafa2b8394a7ccd74536ed7ccc23c34.zip
chromium_src-baeb22f54fafa2b8394a7ccd74536ed7ccc23c34.tar.gz
chromium_src-baeb22f54fafa2b8394a7ccd74536ed7ccc23c34.tar.bz2
Rename AtomicFlag to CancelFlag, change its semantics a bit
Review URL: http://codereview.chromium.org/454025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/cancellation_flag.cc')
-rw-r--r--base/cancellation_flag.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/base/cancellation_flag.cc b/base/cancellation_flag.cc
new file mode 100644
index 0000000..75b6025
--- /dev/null
+++ b/base/cancellation_flag.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/cancellation_flag.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+void CancellationFlag::Set() {
+#if !defined(NDEBUG)
+ DCHECK(set_on_ == PlatformThread::CurrentId());
+#endif
+ base::subtle::Release_Store(&flag_, 1);
+}
+
+bool CancellationFlag::IsSet() const {
+ return base::subtle::Acquire_Load(&flag_) != 0;
+}
+
+} // namespace base