Coding conventions
This commit is contained in:
parent
5842d86a2f
commit
cac03e9080
@ -16,31 +16,31 @@
|
||||
namespace cling {
|
||||
namespace internal {
|
||||
|
||||
class SpinLockGuard {
|
||||
// Trivial spin lock guard
|
||||
class SpinLockGuard {
|
||||
// Trivial spin lock guard
|
||||
|
||||
private:
|
||||
///\brief The atomic flag to be used as a spin lock.
|
||||
///
|
||||
std::atomic_flag& m_Flag;
|
||||
private:
|
||||
///\brief The atomic flag to be used as a spin lock.
|
||||
///
|
||||
std::atomic_flag& m_Flag;
|
||||
|
||||
public:
|
||||
///\brief Spin until we until the flag becomes (or is) false
|
||||
///
|
||||
SpinLockGuard(std::atomic_flag& aflag) : m_Flag(aflag)
|
||||
{
|
||||
while (m_Flag.test_and_set(std::memory_order_acquire));
|
||||
}
|
||||
public:
|
||||
///\brief Spin until we until the flag becomes (or is) false
|
||||
///
|
||||
SpinLockGuard(std::atomic_flag& aflag) : m_Flag(aflag)
|
||||
{
|
||||
while (m_Flag.test_and_set(std::memory_order_acquire));
|
||||
}
|
||||
|
||||
//\brief Release the lock by setting the false to false.
|
||||
~SpinLockGuard()
|
||||
{
|
||||
m_Flag.clear(std::memory_order_release);
|
||||
}
|
||||
//\brief Release the lock by setting the false to false.
|
||||
~SpinLockGuard()
|
||||
{
|
||||
m_Flag.clear(std::memory_order_release);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
} // end of internal namespace
|
||||
} // end of cling namespace
|
||||
|
||||
#endif // end of CLING_THREADING_H
|
||||
#endif // end of CLING_THREADING_H
|
||||
|
Loading…
Reference in New Issue
Block a user