2
* Copyright 2011 Google Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
// Author: morlovich@google.com (Maksim Orlovich)
19
#ifndef PAGESPEED_KERNEL_BASE_ATOMIC_BOOL_H_
20
#define PAGESPEED_KERNEL_BASE_ATOMIC_BOOL_H_
22
#include "pagespeed/kernel/base/atomicops.h"
23
#include "pagespeed/kernel/base/basictypes.h"
25
namespace net_instaweb {
27
// A boolean flag that can be set atomically and be visible to other
28
// threads. Please be extra careful with this --- it can go wrong in
29
// incomprehensible ways; most of the time, you probably want to use a mutex
33
// Guaranteed to be initialized to false.
41
return base::subtle::Acquire_Load(&value_);
44
void set_value(bool v) {
45
base::subtle::Release_Store(&value_, v);
49
base::subtle::AtomicWord value_;
50
DISALLOW_COPY_AND_ASSIGN(AtomicBool);
54
} // namespace net_instaweb
56
#endif // PAGESPEED_KERNEL_BASE_ATOMIC_BOOL_H_