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>
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. | |
Thread * | Owner {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 |
CallerInfo AcqCI |
Source location of the most recent acquirement.
Definition at line 40 of file condition.hpp.
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.
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.
Definition at line 101 of file condition.hpp.
std::atomic<int> CntWaiters {0} |
The number of currently waiting threads.
Definition at line 44 of file condition.hpp.
String Name |
The name of this instance.
Definition at line 38 of file condition.hpp.
CallerInfo NotifyCI |
The most recent call to ReleaseAndNotify or.
Definition at line 43 of file condition.hpp.
Thread* Owner {nullptr} |
Tracks the current owner.
Definition at line 39 of file condition.hpp.
CallerInfo RelCI |
Source location of the most recent release.
Definition at line 41 of file condition.hpp.
CallerInfo WaitCI |
The most recent call to WaitForNotification.
Definition at line 42 of file condition.hpp.
void Assert | ( | bool | cond, |
const CallerInfo & | assertCI, | ||
const CallerInfo & | ci, | ||
const NString & | headline ) |
Writes assertion info and calls ALIB_ASSERT.
cond | The condition that is to be met. |
assertCI | Location where the assertion is placed. |
ci | Location of the call to the method that asserted. |
headline | The message. |
Definition at line 223 of file locks.cpp.
|
inline |
Returns true
if the current owner is the current thread.
Available only in debug-builds.
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.