cancellation_flag.cc 542 Bytes
Newer Older
gejun's avatar
gejun committed
1 2 3 4
// 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.

5
#include "butil/synchronization/cancellation_flag.h"
gejun's avatar
gejun committed
6

7
#include "butil/logging.h"
gejun's avatar
gejun committed
8

9
namespace butil {
gejun's avatar
gejun committed
10 11 12 13 14

void CancellationFlag::Set() {
#if !defined(NDEBUG)
  DCHECK_EQ(set_on_, PlatformThread::CurrentId());
#endif
15
  butil::subtle::Release_Store(&flag_, 1);
gejun's avatar
gejun committed
16 17 18
}

bool CancellationFlag::IsSet() const {
19
  return butil::subtle::Acquire_Load(&flag_) != 0;
gejun's avatar
gejun committed
20 21
}

22
}  // namespace butil