ALib C++ Framework
by
Library Version: 2605 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 320 of file dbgasserters.hpp.

#include <dbgasserters.hpp>

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

Inner Type Index:

struct  ActionInfo
 Collects caller info and the sequence number of actions. More...

Public Static Field Index:

static const char * ASSERTION_FORMAT

Public Field Index:

ActionInfo Acq
 Source location of the most recent acquirement.
std::atomic< int > ActionCounter {1}
 Counter of the actions.
std::thread::id AssertExclusiveWaiter
std::atomic< int > CntWaiters {0}
 The number of currently waiting threads.
const characterName
 The name of this instance.
ActionInfo Notify
 The most recent call to ReleaseAndNotify.
ThreadOwner {nullptr}
 Tracks the current owner.
ActionInfo Rel
 Source location of the most recent release.
ActionInfo Wait

Public Method Index:

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

Field Details:

◆ Acq

ActionInfo alib::threads::DbgConditionAsserter::Acq

Source location of the most recent acquirement.

Definition at line 330 of file dbgasserters.hpp.

◆ ActionCounter

std::atomic<int> alib::threads::DbgConditionAsserter::ActionCounter {1}

Counter of the actions.

Definition at line 328 of file dbgasserters.hpp.

◆ AssertExclusiveWaiter

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

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

Definition at line 336 of file dbgasserters.hpp.

◆ 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"
" Seq / Thread: {} / {}" "\n"
" Latest Release By: {}::{}" "\n"
" At: {}:{}" "\n"
" Seq / Thread: {} / {}" "\n"
"\n"
" Latest Wait By: {}::{}" "\n"
" At: {}:{}" "\n"
" Seq / Thread: {} / {}" "\n"
" Latest Notify By: {}::{}" "\n"
" At: {}:{}" "\n"
" Seq / 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: {}:{}
            Seq / Thread: {} / {}
       Latest Release By: {}::{}
                      At: {}:{}
            Seq / Thread: {} / {}

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

Definition at line 376 of file dbgasserters.hpp.

◆ CntWaiters

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

The number of currently waiting threads.

Definition at line 335 of file dbgasserters.hpp.

◆ Name

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

The name of this instance.

Definition at line 327 of file dbgasserters.hpp.

◆ Notify

ActionInfo alib::threads::DbgConditionAsserter::Notify

The most recent call to ReleaseAndNotify.

Definition at line 334 of file dbgasserters.hpp.

◆ Owner

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

Tracks the current owner.

Definition at line 329 of file dbgasserters.hpp.

◆ Rel

ActionInfo alib::threads::DbgConditionAsserter::Rel

Source location of the most recent release.

Definition at line 331 of file dbgasserters.hpp.

◆ Wait

ActionInfo alib::threads::DbgConditionAsserter::Wait

The most recent call to WaitForNotification(ALIB_DBG_TAKE_CI).

Definition at line 332 of file dbgasserters.hpp.

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
Inherited 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 118 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 394 of file dbgasserters.hpp.

Here is the call graph for this function:

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