BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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 
fc::spin_lock::try_lock_until
bool try_lock_until(const time_point &abs_time)
Definition: spin_lock.cpp:26
fc::spin_lock
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
fc
Definition: api.hpp:15
fc::spin_lock::try_lock_for
bool try_lock_for(const microseconds &rel_time)
Definition: spin_lock.cpp:22
fc::spin_lock::try_lock
bool try_lock()
Definition: spin_lock.cpp:17
fc::spin_lock::unlock
void unlock()
Definition: spin_lock.cpp:39
fc::spin_lock::spin_lock
spin_lock()
Definition: spin_lock.cpp:9
fc::spin_lock::lock
void lock()
Definition: spin_lock.cpp:34
fc::microseconds
Definition: time.hpp:12
fc::time_point
Definition: time.hpp:44