ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::threads::DbgConditionAsserter Struct Reference

Description:

This type is used for debugging and asserting types TCondition. With debug compilations that class holds one member of this struct, which aggregates all debug information.

Definition at line 277 of file dbgasserters.inl.

Collaboration diagram for alib::threads::DbgConditionAsserter:
[legend]

Public Static Field Index:

static ALIB_DLL const char * ASSERTION_FORMAT
 

Public Field Index:

CallerInfo AcqCI
 Source location of the most recent acquirement.
 
std::thread::id AssertExclusiveWaiter
 
std::atomic< int > CntWaiters {0}
 The number of currently waiting threads.
 
const characterName
 The name of this instance.
 
CallerInfo NotifyCI
 The most recent call to ReleaseAndNotify or.
 
ThreadOwner {nullptr}
 Tracks the current owner.
 
CallerInfo RelCI
 Source location of the most recent release.
 
CallerInfo WaitCI
 The most recent call to WaitForNotification.
 

Public Method Index:

ALIB_DLL void Assert (bool cond, const CallerInfo &assertCI, const CallerInfo &ci, const char *headline)
 
bool IsOwnedByCurrentThread () const
 

Field Details:

◆ AcqCI

CallerInfo alib::threads::DbgConditionAsserter::AcqCI

Source location of the most recent acquirement.

Definition at line 281 of file dbgasserters.inl.

◆ AssertExclusiveWaiter

std::thread::id alib::threads::DbgConditionAsserter::AssertExclusiveWaiter

If set from outside, methods WaitForNotification will raise an assertion in the case they are called from a different thread.

Definition at line 286 of file dbgasserters.inl.

◆ ASSERTION_FORMAT

const char * alib::threads::DbgConditionAsserter::ASSERTION_FORMAT
static
Initial value:
=
"Assertion failed in method TCondition::{}" "\n"
" Message: {}" "\n"
" Instance: {}" "\n"
"\n"
" Called By: {}::{}" "\n"
" At: {}:{}" "\n"
" Thread: {}" "\n"
"\n"
" Current Owner: {}" "\n"
" #Of Waiters: {}" "\n"
" Exclusive Waiter: {}" "\n"
"\n"
" Latest Acquisition By: {}::{}" "\n"
" At: {}:{}" "\n"
" Thread: {}" "\n"
" Latest Release By: {}::{}" "\n"
" At: {}:{}" "\n"
" Thread: {}" "\n"
"\n"
" Latest Wait By: {}::{}" "\n"
" At: {}:{}" "\n"
" Thread: {}" "\n"
" Latest Notify By: {}::{}" "\n"
" At: {}:{}" "\n"
" Thread: {}" "\n"

The format string used to write exceptions to the console. This string can be changed if the source information is not "clickable" in a user's development environment.

The default string is optimized for JetBrains CLion and is defined as:

Assertion failed in method TCondition::{}
                 Message: {}
                Instance: {}

               Called By: {}::{}
                      At: {}:{}
                  Thread: {}

           Current Owner: {}
             #Of Waiters: {}
        Exclusive Waiter: {}

   Latest Acquisition By: {}::{}
                      At: {}:{}
                  Thread: {}
       Latest Release By: {}::{}
                      At: {}:{}
                  Thread: {}

          Latest Wait By: {}::{}
                      At: {}:{}
                  Thread: {}
        Latest Notify By: {}::{}
                      At: {}:{}
                  Thread: {}

Definition at line 324 of file dbgasserters.inl.

◆ CntWaiters

std::atomic<int> alib::threads::DbgConditionAsserter::CntWaiters {0}

The number of currently waiting threads.

Definition at line 285 of file dbgasserters.inl.

◆ Name

const character* alib::threads::DbgConditionAsserter::Name

The name of this instance.

Definition at line 279 of file dbgasserters.inl.

◆ NotifyCI

CallerInfo alib::threads::DbgConditionAsserter::NotifyCI

The most recent call to ReleaseAndNotify or.

Definition at line 284 of file dbgasserters.inl.

◆ Owner

Thread* alib::threads::DbgConditionAsserter::Owner {nullptr}

Tracks the current owner.

Definition at line 280 of file dbgasserters.inl.

◆ RelCI

CallerInfo alib::threads::DbgConditionAsserter::RelCI

Source location of the most recent release.

Definition at line 282 of file dbgasserters.inl.

◆ WaitCI

CallerInfo alib::threads::DbgConditionAsserter::WaitCI

The most recent call to WaitForNotification.

Definition at line 283 of file dbgasserters.inl.

Method Details:

◆ Assert()

void alib::threads::DbgConditionAsserter::Assert ( bool cond,
const CallerInfo & assertCI,
const CallerInfo & ci,
const char * headline )

Writes assertion info and calls ALIB_ASSERT.

See also
Field ASSERTION_FORMAT which allows changing the output format to achieve 'clickable' assertion messages.
Parameters
condThe condition that is to be met.
assertCILocation where the assertion is placed.
ciLocation of the call to the method that asserted.
headlineThe message.

Definition at line 146 of file dbgasserters.cpp.

Here is the call graph for this function:

◆ IsOwnedByCurrentThread()

bool alib::threads::DbgConditionAsserter::IsOwnedByCurrentThread ( ) const
inline

Returns true if the current owner is the current thread.

Available only in debug-builds.

Returns
true, if the lock is owned by this thread, false if it is owned by another thread or not owned.

Definition at line 342 of file dbgasserters.inl.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: