BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
spin_yield_lock.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace fc {
4  class microseconds;
5  class time_point;
6 
21  public:
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_until(const time_point &abs_time)
Definition: api.hpp:15
bool try_lock_for(const microseconds &rel_time)
modified spin-lock that yields on failure, but becomes a 'spin lock' if there are no other tasks to y...