8#ifndef HPP_ALIB_LANG_DBGCRITICALSECTIONS
9#define HPP_ALIB_LANG_DBGCRITICALSECTIONS 1
16#if ALIB_DEBUG_CRITICAL_SECTIONS
29#if ALIB_DEBUG && ALIB_THREADS && ALIB_DEBUG_CRITICAL_SECTIONS
44# define ALIB_DCS ALIB_OWN(*this)
45# define ALIB_DCS_SHARED ALIB_OWN_SHARED(*this)
46# define ALIB_DCS_WITH(CS) ALIB_OWN(CS)
47# define ALIB_DCS_SHARED_WITH(CS) ALIB_OWN_SHARED(CS)
48# define ALIB_DCS_ACQUIRE Acquire(ALIB_CALLER);
49# define ALIB_DCS_RELEASE Release(ALIB_CALLER);
50# define ALIB_DCS_ACQUIRE_WITH(CS) CS.Acquire(ALIB_CALLER);
51# define ALIB_DCS_RELEASE_WITH(CS) CS.Release(ALIB_CALLER);
52# define ALIB_DCS_ACQUIRE_SHARED AcquireShared(ALIB_CALLER);
53# define ALIB_DCS_RELEASE_SHARED ReleaseShared(ALIB_CALLER);
54# define ALIB_DCS_ACQUIRE_SHARED_WITH(CS) CS.AcquireShared(ALIB_CALLER);
55# define ALIB_DCS_RELEASE_SHARED_WITH(CS) CS.ReleaseShared(ALIB_CALLER);
58# define ALIB_DCS { alib::DbgAssertSingleThreaded(); }
59# define ALIB_DCS_SHARED { alib::DbgAssertSingleThreaded(); }
60# define ALIB_DCS_WITH(...) { alib::DbgAssertSingleThreaded(); }
61# define ALIB_DCS_RECURSIVE_WITH(...) { alib::DbgAssertSingleThreaded(); }
62# define ALIB_DCS_SHARED_WITH(...) { alib::DbgAssertSingleThreaded(); }
63# define ALIB_DCS_ACQUIRE { alib::DbgAssertSingleThreaded(); }
64# define ALIB_DCS_RELEASE {}
65# define ALIB_DCS_ACQUIRE_WITH(CS) { alib::DbgAssertSingleThreaded(); }
66# define ALIB_DCS_RELEASE_WITH(CS) {}
67# define ALIB_DCS_ACQUIRE_SHARED { alib::DbgAssertSingleThreaded(); }
68# define ALIB_DCS_RELEASE_SHARED {}
69# define ALIB_DCS_ACQUIRE_SHARED_WITH(CS) { alib::DbgAssertSingleThreaded(); }
70# define ALIB_DCS_RELEASE_SHARED_WITH(CS) {}
114#if ALIB_DEBUG_CRITICAL_SECTIONS
233 const char* headline )
const;
#define ALIB_FORCE_INLINE
unsigned int DBG_CRITICAL_SECTION_YIELD_OR_SLEEP_TIME_IN_NS
threads::SharedTimedLock SharedTimedLock
Type alias in namespace alib.
threads::TimedLock TimedLock
Type alias in namespace alib.
threads::Lock Lock
Type alias in namespace alib.
threads::RecursiveLock RecursiveLock
Type alias in namespace alib.
threads::SharedLock SharedLock
Type alias in namespace alib.
threads::RecursiveTimedLock RecursiveTimedLock
Type alias in namespace alib.
virtual bool DCSIsSharedAcquired() const =0
virtual bool DCSIsAcquired() const =0
virtual ~AssociatedLock()
Virtual Destructor.
ALIB_FORCE_INLINE ~DbgCriticalSections()
Destructor. Checks that this instance is unused.
static ALIB_API const char * ASSERTION_FORMAT
ALIB_API void doAssert(bool cond, const CallerInfo &ciAssert, const CallerInfo &ci, const char *headline) const
std::atomic< int > DCSReaderCnt
Tracks enter/exit calls of readers.
CallerInfo DCSAcq
Source location of acquirement.
ALIB_API void ReleaseShared(const CallerInfo &ci) const
int DCSYieldOrSleepTimeInNS
CallerInfo DCSRel
Source location of the last "reader" seen.
ALIB_API void Release(const CallerInfo &ci) const
CallerInfo DCSSAcq
Source location of acquirement.
CallerInfo DCSSRel
Source location of the last "reader" seen.
const char * DCSName
The name of this DCS. Used for debug-output.
ALIB_API void AcquireShared(const CallerInfo &ci) const
ALIB_FORCE_INLINE void yieldOrSleep() const
ALIB_API void Acquire(const CallerInfo &ci) const
ALIB_FORCE_INLINE DbgCriticalSections(const char *name)
std::atomic< int > DCSWriterCnt
Tracks enter/exit calls (including readers)