1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef BASE_SYNCHRONIZATION_ATOMIC_FLAG_H_
- #define BASE_SYNCHRONIZATION_ATOMIC_FLAG_H_
- #include <stdint.h>
- #include <atomic>
- #include "base/base_export.h"
- #include "base/macros.h"
- #include "base/sequence_checker.h"
- namespace base {
- class BASE_EXPORT AtomicFlag {
- public:
- AtomicFlag();
- ~AtomicFlag();
-
- void Set();
-
-
-
- bool IsSet() const {
-
- return flag_.load(std::memory_order_acquire) != 0;
- }
-
-
- void UnsafeResetForTesting();
- private:
- std::atomic<uint_fast8_t> flag_{0};
- SEQUENCE_CHECKER(set_sequence_checker_);
- DISALLOW_COPY_AND_ASSIGN(AtomicFlag);
- };
- }
- #endif
|