blob: ca5c0a82837070742e63914f79e57d924721efd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Copyright (c) 2011 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/synchronization/cancellation_flag.h"
#include "base/logging.h"
namespace base {
void CancellationFlag::Set() {
#if !defined(NDEBUG)
DCHECK_EQ(set_on_, PlatformThread::CurrentId());
#endif
base::subtle::Release_Store(&flag_, 1);
}
bool CancellationFlag::IsSet() const {
return base::subtle::Acquire_Load(&flag_) != 0;
}
void CancellationFlag::UnsafeResetForTesting() {
base::subtle::Release_Store(&flag_, 0);
}
} // namespace base
|