Reformat all the things. Have fun with merge conflicts.

This commit is contained in:
Pierre Bourdon
2016-06-24 10:43:46 +02:00
parent 2115e8a4a6
commit 3570c7f03a
1116 changed files with 187405 additions and 180344 deletions

View File

@ -19,44 +19,27 @@
#include <atomic>
namespace Common {
namespace Common
{
class Flag final
{
public:
// Declared as explicit since we do not want "= true" to work on a flag
// object - it should be made explicit that a flag is *not* a normal
// variable.
explicit Flag(bool initial_value = false) : m_val(initial_value) {}
void Set(bool val = true)
{
m_val.store(val);
}
void Clear()
{
Set(false);
}
bool IsSet() const
{
return m_val.load();
}
bool TestAndSet(bool val = true)
{
bool expected = !val;
return m_val.compare_exchange_strong(expected, val);
}
bool TestAndClear()
{
return TestAndSet(false);
}
// Declared as explicit since we do not want "= true" to work on a flag
// object - it should be made explicit that a flag is *not* a normal
// variable.
explicit Flag(bool initial_value = false) : m_val(initial_value) {}
void Set(bool val = true) { m_val.store(val); }
void Clear() { Set(false); }
bool IsSet() const { return m_val.load(); }
bool TestAndSet(bool val = true)
{
bool expected = !val;
return m_val.compare_exchange_strong(expected, val);
}
bool TestAndClear() { return TestAndSet(false); }
private:
std::atomic_bool m_val;
std::atomic_bool m_val;
};
} // namespace Common