Paweł Bylica
8 years ago
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
1 changed files with
0 additions and
12 deletions
-
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 |
|
|
|
{ |
|
|
|