ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
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 36 of file condition.hpp.

#include <condition.hpp>

Collaboration diagram for DbgConditionAsserter:
[legend]

Public Static Field Index:

static ALIB_API NString 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.
 
String Name
 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_API void Assert (bool cond, const CallerInfo &assertCI, const CallerInfo &ci, const NString &headline)
 
bool IsOwnedByCurrentThread () const
 

Field Details:

◆ AcqCI

CallerInfo AcqCI

Source location of the most recent acquirement.

Definition at line 40 of file condition.hpp.

◆ AssertExclusiveWaiter

std::thread::id AssertExclusiveWaiter

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

Definition at line 45 of file condition.hpp.

◆ ASSERTION_FORMAT

ALIB_API NString ASSERTION_FORMAT
static

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::{2:sm}
                 Message: {0}
                Instance: {1}

               Called By: {3:ya}
                      At: {3:sf:sl}
                  Thread: {3:ta}

           Current Owner: {4}
             #Of Waiters: {5}
        Exclusive Waiter: {6}

   Latest Acquisition By: {7:ya}
                      At: {7:sf:sl}
                  Thread: {7:ta}
       Latest Release By: {8:ya}
                      At: {8:sf:sl}
                  Thread: {8:ta}

          Latest Wait By: {9:ya}
                      At: {9:sf:sl}
                  Thread: {9:ta}
        Latest Notify By: {10:ya}
                      At: {10:sf:sl}
                  Thread: {10:ta}

The placeholder fields that this format string refers to are set as follows:

  • 0: Headline.
  • 1: Debug-name of the condition.
  • 2: CallerInfo of assertion.
  • 3: CallerInfo of caller.
  • 4: CallerInfo of latest acquisition.
  • 5: The number of waiting threads.
  • 6: std::thread::id of an exclusive waiter thread (which can be optionally set).
  • 7: CallerInfo of latest acquisition.
  • 8: CallerInfo of latest release.
  • 9: CallerInfo of latest wait call.
  • 10: CallerInfo of latest notification.

The format specification of the type CallerInfo is defined with class FMTCallerInfo.

Availability:
This field is only available with the inclusion of ALib BaseCamp in the ALib Distribution.

Definition at line 101 of file condition.hpp.

◆ CntWaiters

std::atomic<int> CntWaiters {0}

The number of currently waiting threads.

Definition at line 44 of file condition.hpp.

◆ Name

String Name

The name of this instance.

Definition at line 38 of file condition.hpp.

◆ NotifyCI

CallerInfo NotifyCI

The most recent call to ReleaseAndNotify or.

Definition at line 43 of file condition.hpp.

◆ Owner

Thread* Owner {nullptr}

Tracks the current owner.

Definition at line 39 of file condition.hpp.

◆ RelCI

CallerInfo RelCI

Source location of the most recent release.

Definition at line 41 of file condition.hpp.

◆ WaitCI

CallerInfo WaitCI

The most recent call to WaitForNotification.

Definition at line 42 of file condition.hpp.

Method Details:

◆ Assert()

void Assert ( bool cond,
const CallerInfo & assertCI,
const CallerInfo & ci,
const NString & 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 223 of file locks.cpp.

Here is the call graph for this function:

◆ IsOwnedByCurrentThread()

bool 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 120 of file condition.hpp.

Here is the call graph for this function:

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