BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
spin_lock.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace fc {
4  class microseconds;
5  class time_point;
6 
20  class spin_lock {
21  public:
22  spin_lock();
23  bool try_lock();
24  bool try_lock_for( const microseconds& rel_time );
25  bool try_lock_until( const time_point& abs_time );
26  void lock();
27  void unlock();
28 
29  private:
30  enum lock_store {locked,unlocked};
31  int _lock;
32  };
33 
34 } // namespace fc
35 
bool try_lock()
Definition: spin_lock.cpp:17
void unlock()
Definition: spin_lock.cpp:39
modified spin-lock that yields on failure, but becomes a 'spin lock' if there are no other tasks to y...
Definition: spin_lock.hpp:20
bool try_lock_until(const time_point &abs_time)
Definition: spin_lock.cpp:26
bool try_lock_for(const microseconds &rel_time)
Definition: spin_lock.cpp:22
Definition: api.hpp:15