Browse Source

Remove SpinLock

master
Paweł Bylica 8 years ago
parent
commit
784af6c79a
No known key found for this signature in database GPG Key ID: 7A0C037434FE77EF
  1. 12
      libdevcore/Guards.h

12
libdevcore/Guards.h

@ -39,18 +39,6 @@ struct GenericGuardBool: GuardType
bool b = true;
};
/** @brief Simple lock that waits for release without making context switch */
class SpinLock
{
public:
SpinLock() { m_lock.clear(); }
void lock() { while (m_lock.test_and_set(std::memory_order_acquire)) {} }
void unlock() { m_lock.clear(std::memory_order_release); }
private:
std::atomic_flag m_lock;
};
using SpinGuard = std::lock_guard<SpinLock>;
template <class N>
class Notified
{

Loading…
Cancel
Save