BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
mutex.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <fc/time.hpp>
4 
5 namespace fc {
6  class microseconds;
7  class time_point;
8  struct context;
9 
91  class mutex {
92  public:
93  mutex();
94  ~mutex();
95 
96  bool try_lock();
97  bool try_lock_for( const microseconds& rel_time );
98  bool try_lock_until( const time_point& abs_time );
99  void lock();
100  void unlock();
101 
102  private:
103  fc::spin_yield_lock m_blist_lock;
104  fc::context* m_blist;
105  unsigned recursive_lock_count;
106  };
107 
108 } // namespace fc
109 
mutex()
Definition: mutex.cpp:10
bool try_lock()
Definition: mutex.cpp:82
bool try_lock_for(const microseconds &rel_time)
mutex
Definition: mutex.hpp:91
void lock()
Definition: mutex.cpp:135
~mutex()
Definition: mutex.cpp:15
Definition: api.hpp:15
bool try_lock_until(const time_point &abs_time)
Definition: mutex.cpp:100
void unlock()
Definition: mutex.cpp:193
modified spin-lock that yields on failure, but becomes a &#39;spin lock&#39; if there are no other tasks to y...