8#if !ALIB_SINGLE_THREADED && ALIB_DEBUG
23 const char*
Name =
"<unnamed>";
80 Ticks::Duration
WaitTimeLimit = Ticks::Duration::FromAbsoluteSeconds(2);
105 {
return CntAcquirements.load() > 0 &&
Acq.CI.ThreadID == std::this_thread::get_id(); }
130 const char* headline );
138 DoAssert( 0, assertCI, ci,
"Not acquired" );
147 DoAssert( 0, assertCI, requestCI,
"Already (still) owned." );
165 DoAssert( 0, assertCI, requestCI,
"Release without having ownership");
178 DoAssert( 0, assertCI, ci, headline);
257 const char* headline )
override;
275 DoAssert( 0, assertCI, requestCI,
"Already (still) shared-owned." );
288 DoAssert( 0, assertCI, requestCI,
"Already (still) owned." );
292 "Too many parallel shared acquisitions detected. "
293 "A reason might be that shared acquirers do not call ReleaseShared" );
304 if ( prevCounter <= 0 )
306 "Too many invocations of ReleaseShared (from any thread) without prior acquisition" );
388 const char* headline );
static Thread * GetCurrent()
lang::CallerInfo CallerInfo
Type alias in namespace #"%alib".
characters::character character
Type alias in namespace #"%alib".
std::thread::id ThreadID
The ID of the calling thread.
Collects caller info and the sequence number of actions.
int ActionNo
The sequence number of the action.
CallerInfo CI
The caller information.
std::thread::id AssertExclusiveWaiter
ActionInfo Rel
Source location of the most recent release.
std::atomic< int > ActionCounter
Counter of the actions.
bool IsOwnedByCurrentThread() const
void Assert(bool cond, const CallerInfo &assertCI, const CallerInfo &ci, const char *headline)
const character * Name
The name of this instance.
ActionInfo Acq
Source location of the most recent acquirement.
static const char * ASSERTION_FORMAT
Thread * Owner
Tracks the current owner.
ActionInfo Notify
The most recent call to #"%ReleaseAndNotify".
std::atomic< int > CntWaiters
The number of currently waiting threads.
Collects caller info and the sequence number of actions.
int ActionNo
The sequence number of the action.
CallerInfo CI
The caller information.
void AssertOwned(const CallerInfo &assertCI, const CallerInfo &ci)
static const char * ASSERTION_FORMAT
ActionInfo Rel
Source location of the most recent release.
bool IsOwnedByCurrentThread() const
virtual void DoAssert(int type, const CallerInfo &assertCI, const CallerInfo &ci, const char *headline)
Thread * GetOwner() const
ActionInfo Acq
Source location of the most recent acquirement.
void AssertNotOwning(const CallerInfo &assertCI, const CallerInfo &ci, const char *headline)
std::atomic< int > CntAcquirements
The number of shared acquirements.
bool WillRelease() const noexcept
void SetRecursiveOwner(const CallerInfo &assertCI, const CallerInfo &requestCI)
std::atomic< int > ActionCounter
Counter of the actions.
virtual ~DbgLockAsserter()
Destructor.
void Release(const CallerInfo &assertCI, const CallerInfo &requestCI)
void SetOwner(const CallerInfo &assertCI, const CallerInfo &requestCI)
Ticks::Duration WaitTimeLimit
ActionInfo SAcq
The most recent shared acquirement's caller.
bool IsSharedOwnedByAnyThread() const
virtual ~DbgSharedLockAsserter() override
Destructor.
void DoAssert(int type, const CallerInfo &assertCI, const CallerInfo &ci, const char *headline) override
void SetOwner(const CallerInfo &assertCI, const CallerInfo &requestCI)
static const char * ASSERTION_FORMAT_SHARED
void SetSharedOwner(const CallerInfo &assertCI, const CallerInfo &requestCI, int warnLimit)
std::atomic< int > CntSharedAcquirements
The number of shared acquirements.
void ReleaseShared(const CallerInfo &assertCI, const CallerInfo &requestCI)
ActionInfo SRel
The most recent shared release caller.