BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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 
fc::mutex::try_lock
bool try_lock()
Definition: mutex.cpp:83
fc::mutex
mutex
Definition: mutex.hpp:91
fc::mutex::mutex
mutex()
Definition: mutex.cpp:10
fc
Definition: api.hpp:15
spin_yield_lock.hpp
fc::mutex::lock
void lock()
Definition: mutex.cpp:136
fc::context
Definition: context.hpp:47
fc::mutex::try_lock_for
bool try_lock_for(const microseconds &rel_time)
fc::spin_yield_lock
modified spin-lock that yields on failure, but becomes a 'spin lock' if there are no other tasks to y...
Definition: spin_yield_lock.hpp:20
fc::microseconds
Definition: time.hpp:12
fc::time_point
Definition: time.hpp:44
fc::mutex::try_lock_until
bool try_lock_until(const time_point &abs_time)
Definition: mutex.cpp:101
fc::mutex::~mutex
~mutex()
Definition: mutex.cpp:15
time.hpp
fc::mutex::unlock
void unlock()
Definition: mutex.cpp:194