Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Macros | Typedefs
sync.h File Reference
#include <threadsafety.h>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
Include dependency graph for sync.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AnnotatedMixin< PARENT >
 Template mixin that adds -Wthread-safety locking annotations to a subset of the mutex API. More...
 
class  CCriticalSection
 Wrapped boost mutex: supports recursive locking, but no waiting TODO: We should move away from using the recursive lock by default. More...
 
class  CMutexLock< Mutex >
 Wrapper around boost::unique_lock<Mutex> More...
 
class  CSemaphore
 
class  CSemaphoreGrant
 RAII-style semaphore lock. More...
 

Macros

#define AssertLockHeld(cs)   AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
 
#define PASTE(x, y)   x ## y
 
#define PASTE2(x, y)   PASTE(x, y)
 
#define LOCK(cs)   CCriticalBlock PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
 
#define LOCK2(cs1, cs2)   CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__), criticalblock2(cs2, #cs2, __FILE__, __LINE__)
 
#define TRY_LOCK(cs, name)   CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)
 
#define ENTER_CRITICAL_SECTION(cs)
 
#define LEAVE_CRITICAL_SECTION(cs)
 

Typedefs

typedef AnnotatedMixin< boost::mutex > CWaitableCriticalSection
 Wrapped boost mutex: supports waiting but not recursive locking. More...
 
typedef boost::condition_variable CConditionVariable
 Just a typedef for boost::condition_variable, can be wrapped later if desired. More...
 
typedef CMutexLock< CCriticalSectionCCriticalBlock
 

Macro Definition Documentation

#define AssertLockHeld (   cs)    AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)

Definition at line 85 of file sync.h.

#define ENTER_CRITICAL_SECTION (   cs)
Value:
{ \
EnterCritical(#cs, __FILE__, __LINE__, (void*)(&cs)); \
(cs).lock(); \
}

Definition at line 179 of file sync.h.

#define LEAVE_CRITICAL_SECTION (   cs)
Value:
{ \
(cs).unlock(); \
LeaveCritical(); \
}

Definition at line 185 of file sync.h.

#define LOCK (   cs)    CCriticalBlock PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)

Definition at line 175 of file sync.h.

#define LOCK2 (   cs1,
  cs2 
)    CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__), criticalblock2(cs2, #cs2, __FILE__, __LINE__)

Definition at line 176 of file sync.h.

#define PASTE (   x,
 
)    x ## y

Definition at line 172 of file sync.h.

#define PASTE2 (   x,
 
)    PASTE(x, y)

Definition at line 173 of file sync.h.

#define TRY_LOCK (   cs,
  name 
)    CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)

Definition at line 177 of file sync.h.

Typedef Documentation

typedef boost::condition_variable CConditionVariable

Just a typedef for boost::condition_variable, can be wrapped later if desired.

Definition at line 103 of file sync.h.

Definition at line 170 of file sync.h.

Wrapped boost mutex: supports waiting but not recursive locking.

Definition at line 100 of file sync.h.