ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
locks.cpp
1//##################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6//##################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14//========================================= Global Fragment ========================================
15#include "alib/alib.inl"
16#if ALIB_DEBUG && !ALIB_STRINGS
17# include <format>
18#endif
19//============================================== Module ============================================
20#if ALIB_C20_MODULES
21 module ALib.Threads;
22 import ALib.Lang;
23# if ALIB_STRINGS
24 import ALib.Strings;
25# endif
26#else
27# include "ALib.Threads.H"
28# include "ALib.Strings.H"
29# include "ALib.Lang.H"
30#endif
31//========================================== Implementation ========================================
32#if !ALIB_SINGLE_THREADED
33
34namespace alib { namespace threads {
35
36//##################################################################################################
37// Globals
38//##################################################################################################
39/// This global mutex is acquired by \alib-types, whenever data is written to either
40/// <c>std::cout</c> or <c>std::cerr</c>.
41/// This is, for example, acquired by function #alib::assert::Raise and by loggers of
42/// module \alib_alox that log to the console
43/// (\ref alib_mod_alox_loggers_textlogger_stdio_lock "see here").
44///
45/// The utility type \alib{strings::compatibility::std;OStreamWriter} uses this lock as well
46/// as C++20 type <b>std::basic_osyncstream</b> (if available with the toolchain used) to have
47/// maximum protection in respect to writing to the console.
49
50//##################################################################################################
51// Debug-Versions of Lock-Types
52//##################################################################################################
53#if ALIB_DEBUG
55 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
56
57 if ( !Dbg.WaitTimeLimit.IsZero() ) {
58 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
59 Ticks overallTimer;
60 Ticks waitTimer;
61 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
62 if ( waitTimer.Age() < waitDuration )
63 continue; // spurious wakeup
64
65 #if ALIB_STRINGS
66 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
67 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
68 #else
69 std::string msg("Waiting to acquire a lock since ");
70 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
71 msg+= " ms";
72 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
73 #endif
74
75 waitTimer.Reset();
76 } }
77 else
78 mutex.lock();
79
80 Dbg.SetOwner( ALIB_CALLER, ci );
81}
82
84 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
85
86 if (!mutex.try_lock() )
87 return false;
88
89 Dbg.SetOwner( ALIB_CALLER, ci );
90 return true;
91}
92
94 Dbg.AssertOwned ( ALIB_CALLER, ci );
95 Dbg.Release( ALIB_CALLER, ci);
96 mutex.unlock();
97}
98#endif // ALIB_DEBUG
99
100//##################################################################################################
101// Class TimedLock
102//##################################################################################################
103#if !ALIB_DEBUG
104bool TimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration )
105{
106 Ticks::Duration remainingDuration= waitDuration;
107 Ticks timer;
108 while (!mutex.try_lock_for( remainingDuration.Export() ) )
109 {
110 remainingDuration= waitDuration - timer.Age();
111 if ( remainingDuration.IsPositive() )
112 continue; // spurious wakeup
113 return false;
114 }
115 return true;
116}
117#else
118
120 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
121
122 if ( !Dbg.WaitTimeLimit.IsZero() ) {
123 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
124 Ticks overallTimer;
125 Ticks waitTimer;
126 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
127 if ( waitTimer.Age() < waitDuration )
128 continue; // spurious wakeup
129
130 #if ALIB_STRINGS
131 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
132 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
133 #else
134 std::string msg("Waiting to acquire a lock since ");
135 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
136 msg+= " ms";
137 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
138 #endif
139
140 waitTimer.Reset();
141 } }
142 else
143 mutex.lock();
144
145 Dbg.SetOwner( ALIB_CALLER, ci );
146}
147
149 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
150
151 if (!mutex.try_lock() )
152 return false;
153
154 Dbg.SetOwner( ALIB_CALLER, ci );
155 return true;
156}
157
158bool TimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration,
159 const CallerInfo& ci ) {
160 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
161
162 Ticks::Duration remainingDuration= waitDuration;
163 Ticks timer;
164 while (!mutex.try_lock_for( remainingDuration.Export() ) ) {
165 remainingDuration= waitDuration - timer.Age();
166 if ( remainingDuration.IsPositive() )
167 continue; // spurious wakeup
168 return false;
169 }
170
171 Dbg.SetOwner( ALIB_CALLER, ci );
172 return true;
173}
175 Dbg.AssertOwned ( ALIB_CALLER, ci );
176 Dbg.Release( ALIB_CALLER, ci);
177 mutex.unlock();
178}
179#endif // ALIB_DEBUG
180
181#if ALIB_DEBUG
183 if ( !Dbg.WaitTimeLimit.IsZero() ) {
184 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
185 Ticks overallTimer;
186 Ticks waitTimer;
187 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
188 if ( waitTimer.Age() < waitDuration )
189 continue; // spurious wakeup
190
191 #if ALIB_STRINGS
192 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
193 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
194 #else
195 std::string msg("Waiting to acquire a lock since ");
196 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
197 msg+= " ms";
198 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
199 #endif
200 waitTimer.Reset();
201 } }
202 else
203 mutex.lock();
204
205 Dbg.SetRecursiveOwner( ALIB_CALLER, ci );
206}
207
209 if (!mutex.try_lock() )
210 return false;
211 Dbg.SetRecursiveOwner( ALIB_CALLER, ci );
212 return true;
213}
214
216 Dbg.AssertOwned ( ALIB_CALLER, ci );
217 Dbg.Release( ALIB_CALLER, ci);
218 mutex.unlock();
219}
220#endif // ALIB_DEBUG
221
222#if !ALIB_DEBUG
223bool RecursiveTimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration )
224{
225 Ticks::Duration remainingDuration= waitDuration;
226 Ticks timer;
227 while (!mutex.try_lock_for( remainingDuration.Export() ) )
228 {
229 remainingDuration= waitDuration - timer.Age();
230 if ( remainingDuration.IsPositive() )
231 continue; // spurious wakeup
232 return false;
233 }
234 return true;
235}
236#else
238 if ( !Dbg.WaitTimeLimit.IsZero() ) {
239 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
240 Ticks overallTimer;
241 Ticks waitTimer;
242 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
243 if ( waitTimer.Age() < waitDuration )
244 continue; // spurious wakeup
245
246 #if ALIB_STRINGS
247 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
248 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
249 #else
250 std::string msg("Waiting to acquire a lock since ");
251 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
252 msg+= " ms";
253 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
254 #endif
255
256 waitTimer.Reset();
257 } }
258 else
259 mutex.lock();
260
261 Dbg.SetRecursiveOwner( ALIB_CALLER, ci );
262}
263
265 if (!mutex.try_lock() )
266 return false;
267
268 Dbg.SetRecursiveOwner( ALIB_CALLER, ci );
269 return true;
270}
271
272bool RecursiveTimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration,
273 const CallerInfo& ci ) {
274 Ticks::Duration remainingDuration= waitDuration;
275 Ticks timer;
276 while (!mutex.try_lock_for( remainingDuration.Export() ) ) {
277 remainingDuration= waitDuration - timer.Age();
278 if ( remainingDuration.IsPositive() )
279 continue; // spurious wakeup
280 return false;
281 }
282
283 Dbg.SetRecursiveOwner( ALIB_CALLER, ci );
284 return true;
285}
286
288 Dbg.AssertOwned ( ALIB_CALLER, ci );
289 Dbg.Release( ALIB_CALLER, ci);
290 mutex.unlock();
291}
292#endif // ALIB_DEBUG
293
294#if ALIB_DEBUG
296 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
297
298 if ( !Dbg.WaitTimeLimit.IsZero() ) {
299 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
300 Ticks overallTimer;
301 Ticks waitTimer;
302 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
303 if ( waitTimer.Age() < waitDuration )
304 continue; // spurious wakeup
305
306 #if ALIB_STRINGS
307 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
308 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
309 #else
310 std::string msg("Waiting to acquire a lock since ");
311 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
312 msg+= " ms";
313 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
314 #endif
315
316 waitTimer.Reset();
317 } }
318 else
319 mutex.lock();
320
321 Dbg.SetOwner( ALIB_CALLER, ci );
322}
323
325 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
326
327 if (!mutex.try_lock() )
328 return false;
329
330 Dbg.SetOwner( ALIB_CALLER, ci );
331 return true;
332}
333
335 Dbg.AssertOwned ( ALIB_CALLER, ci );
336 Dbg.Release( ALIB_CALLER, ci);
337 mutex.unlock();
338}
339
341 Dbg.AssertNotOwning( ALIB_CALLER, ci,
342 "AcquireShared while already owning. (This is not allowed with std::shared_lock)" );
343
344 if ( !Dbg.WaitTimeLimit.IsZero() ) {
345 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
346 Ticks overallTimer;
347 Ticks waitTimer;
348 while (!mutex.try_lock_shared_for( (waitDuration - waitTimer.Age()).Export() ) ) {
349 if ( waitTimer.Age() < waitDuration )
350 continue; // spurious wakeup
351
352 #if ALIB_STRINGS
353 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
354 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
355 #else
356 std::string msg("Waiting to acquire a lock since ");
357 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
358 msg+= " ms";
359 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
360 #endif
361
362 waitTimer.Reset();
363 } }
364 else
365 mutex.lock_shared();
366
367 Dbg.SetSharedOwner( ALIB_CALLER, ci, DbgWarningMaximumShared );
368}
369
371 Dbg.AssertNotOwning( ALIB_CALLER, ci,
372 "AcquireShared while already owning. (This is not allowed with std::shared_lock)" );
373
374 if ( !mutex.try_lock_shared() )
375 return false;
376
377 Dbg.SetSharedOwner( ALIB_CALLER, ci, DbgWarningMaximumShared );
378 return true;
379}
380
382{
383 Dbg.ReleaseShared( ALIB_CALLER, ci);
384 mutex.unlock_shared();
385}
386#endif // ALIB_DEBUG
387
388#if !ALIB_DEBUG
389bool SharedTimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration )
390{
391 Ticks::Duration remainingDuration= waitDuration;
392 Ticks timer;
393 while (!mutex.try_lock_for( remainingDuration.Export() ) )
394 {
395 remainingDuration= waitDuration - timer.Age();
396 if ( remainingDuration.IsPositive() )
397 continue; // spurious wakeup
398 return false;
399 }
400 return true;
401}
402#else
404 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
405
406 if ( !Dbg.WaitTimeLimit.IsZero() ) {
407 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
408 Ticks overallTimer;
409 Ticks waitTimer;
410 while (!mutex.try_lock_for( (waitDuration - waitTimer.Age()).Export() ) ) {
411 if ( waitTimer.Age() < waitDuration )
412 continue; // spurious wakeup
413
414 #if ALIB_STRINGS
415 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
416 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
417 #else
418 std::string msg("Waiting to acquire a lock since ");
419 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
420 msg+= " ms";
421 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
422 #endif
423
424 waitTimer.Reset();
425 } }
426 else
427 mutex.lock();
428
429 Dbg.SetOwner( ALIB_CALLER, ci );
430}
432 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
433
434 if (!mutex.try_lock() )
435 return false;
436
437 Dbg.SetOwner( ALIB_CALLER, ci );
438 return true;
439}
440
441bool SharedTimedLock::TryAcquireTimed( const Ticks::Duration& waitDuration,
442 const CallerInfo& ci ) {
443 Dbg.AssertNotOwning( ALIB_CALLER, ci, "Illegal nested acquisition" );
444
445 Ticks::Duration remainingDuration= waitDuration;
446 Ticks timer;
447 while (!mutex.try_lock_for( remainingDuration.Export() ) ) {
448 remainingDuration= waitDuration - timer.Age();
449 if ( remainingDuration.IsPositive() )
450 continue; // spurious wakeup
451 return false;
452 }
453
454 Dbg.SetOwner( ALIB_CALLER, ci );
455 return true;
456}
457
459 Dbg.AssertOwned ( ALIB_CALLER, ci );
460 Dbg.Release( ALIB_CALLER, ci);
461 mutex.unlock();
462}
463#endif
464
465#if !ALIB_DEBUG
466bool SharedTimedLock::TryAcquireSharedTimed( const Ticks::Duration& waitDuration )
467{
468 Ticks::Duration remainingDuration= waitDuration;
469 Ticks timer;
470 while (!mutex.try_lock_shared_for( remainingDuration.Export() ) )
471 {
472 remainingDuration= waitDuration - timer.Age();
473 if ( remainingDuration.IsPositive() )
474 continue; // spurious wakeup
475 return false;
476 }
477 return true;
478}
479
480#else
481
483 Dbg.AssertNotOwning( ALIB_CALLER, ci,
484 "AcquireShared while already owning. (This is not allowed with std::shared_lock)" );
485
486 if ( !Dbg.WaitTimeLimit.IsZero() ) {
487 Ticks::Duration waitDuration= Dbg.WaitTimeLimit;
488 Ticks overallTimer;
489 Ticks waitTimer;
490 while (!mutex.try_lock_shared_for( (waitDuration - waitTimer.Age()).Export() ) ) {
491 if ( waitTimer.Age() < waitDuration )
492 continue; // spurious wakeup
493
494 #if ALIB_STRINGS
495 NAString msg("Waiting to acquire a lock since "); msg << overallTimer.Age();
496 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg);
497 #else
498 std::string msg("Waiting to acquire a lock since ");
499 msg+= std::format("{}", overallTimer.Age().InAbsoluteMilliseconds());
500 msg+= " ms";
501 Dbg.DoAssert( 1, ALIB_CALLER, ci, msg.c_str());
502 #endif
503
504 waitTimer.Reset();
505 } }
506 else
507 mutex.lock_shared();
508
509 Dbg.SetSharedOwner( ALIB_CALLER, ci, DbgWarningMaximumShared );
510}
511
513 Dbg.AssertNotOwning( ALIB_CALLER, ci,
514 "AcquireShared while already owning. (This is not allowed with std::shared_lock)" );
515
516 if ( !mutex.try_lock_shared() )
517 return false;
518
519 Dbg.SetSharedOwner( ALIB_CALLER, ci, DbgWarningMaximumShared );
520 return true;
521}
522
523bool SharedTimedLock::TryAcquireSharedTimed( const Ticks::Duration& waitDuration,
524 const CallerInfo& ci ) {
525 Dbg.AssertNotOwning( ALIB_CALLER, ci,
526 "AcquireShared while already owning. (This is not allowed with std::shared_lock)" );
527
528 Ticks::Duration remainingDuration= waitDuration;
529 Ticks timer;
530 while (!mutex.try_lock_shared_for( remainingDuration.Export() ) ) {
531 remainingDuration= waitDuration - timer.Age();
532 if ( remainingDuration.IsPositive() )
533 continue; // spurious wakeup
534 return false;
535 }
536
537 Dbg.SetSharedOwner( ALIB_CALLER, ci, DbgWarningMaximumShared );
538 return true;
539}
540
542{
543 Dbg.ReleaseShared( ALIB_CALLER, ci);
544 mutex.unlock_shared();
545}
546
547#endif // ALIB_DEBUG
548
549#if ALIB_DEBUG_CRITICAL_SECTIONS
550bool Lock ::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
551bool Lock ::DCSIsSharedAcquired() const { return Dbg.IsOwnedByCurrentThread(); }
552bool TimedLock ::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
553bool TimedLock ::DCSIsSharedAcquired() const { return Dbg.IsOwnedByCurrentThread(); }
554bool RecursiveLock ::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
555bool RecursiveLock ::DCSIsSharedAcquired() const { return Dbg.IsOwnedByCurrentThread(); }
556bool RecursiveTimedLock::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
557bool RecursiveTimedLock::DCSIsSharedAcquired() const { return Dbg.IsOwnedByCurrentThread(); }
558bool SharedLock ::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
559bool SharedLock ::DCSIsSharedAcquired() const { return Dbg.IsSharedOwnedByAnyThread()
560 || Dbg.IsOwnedByCurrentThread(); }
561bool SharedTimedLock ::DCSIsAcquired () const { return Dbg.IsOwnedByCurrentThread(); }
562bool SharedTimedLock ::DCSIsSharedAcquired() const { return Dbg.IsSharedOwnedByAnyThread()
563 || Dbg.IsOwnedByCurrentThread(); }
564#endif // ALIB_DEBUG_CRITICAL_SECTIONS
565
566}} // namespace [alib::threads]
567
568#endif // !ALIB_SINGLE_THREADED
DbgLockAsserter Dbg
The debug tool instance.
Definition lock.inl:65
std::mutex mutex
Definition lock.inl:58
ALIB_DLL void Release(ALIB_DBG_TAKE_CI)
Definition locks.cpp:93
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:83
ALIB_DLL void Acquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:54
ALIB_DLL void AcquireRecursive(ALIB_DBG_TAKE_CI)
Definition locks.cpp:182
std::recursive_mutex mutex
ALIB_DLL void ReleaseRecursive(ALIB_DBG_TAKE_CI)
Definition locks.cpp:215
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:208
DbgLockAsserter Dbg
The debug tool instance.
ALIB_DLL void ReleaseRecursive(ALIB_DBG_TAKE_CI)
Definition locks.cpp:287
DbgLockAsserter Dbg
The debug tool instance.
virtual ALIB_DLL bool DCSIsAcquired() const override
Definition locks.cpp:556
std::recursive_timed_mutex mutex
The internal object to lock on.
virtual ALIB_DLL bool DCSIsSharedAcquired() const override
Definition locks.cpp:557
ALIB_DLL bool TryAcquireTimed(const Ticks::Duration &waitDuration, const CallerInfo &ci)
Definition locks.cpp:272
ALIB_DLL void AcquireRecursive(ALIB_DBG_TAKE_CI)
Definition locks.cpp:237
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:264
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:324
std::atomic< int > DbgWarningMaximumShared
ALIB_DLL void Release(ALIB_DBG_TAKE_CI)
Definition locks.cpp:334
std::shared_mutex mutex
DbgSharedLockAsserter Dbg
The debug tool instance.
ALIB_DLL void ReleaseShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:381
ALIB_DLL void AcquireShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:340
ALIB_DLL bool TryAcquireShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:370
ALIB_DLL void Acquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:295
DbgSharedLockAsserter Dbg
The debug tool instance.
std::shared_timed_mutex mutex
The internal object to lock on.
ALIB_DLL void AcquireShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:482
ALIB_DLL void Acquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:403
ALIB_DLL bool TryAcquireShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:512
std::atomic< int > DbgWarningMaximumShared
ALIB_DLL void ReleaseShared(ALIB_DBG_TAKE_CI)
Definition locks.cpp:541
ALIB_DLL bool TryAcquireTimed(const Ticks::Duration &waitDuration, const CallerInfo &ci)
Definition locks.cpp:441
ALIB_DLL bool TryAcquireSharedTimed(const Ticks::Duration &waitDuration, const CallerInfo &ci)
Definition locks.cpp:523
ALIB_DLL void Release(ALIB_DBG_TAKE_CI)
Definition locks.cpp:458
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:431
DbgLockAsserter Dbg
The debug tool instance.
Definition timedlock.inl:55
ALIB_DLL bool TryAcquireTimed(const Ticks::Duration &waitDuration, const CallerInfo &ci)
Definition locks.cpp:158
ALIB_DLL void Release(ALIB_DBG_TAKE_CI)
Definition locks.cpp:174
std::timed_mutex mutex
The internal object to lock on.
Definition timedlock.inl:50
ALIB_DLL bool TryAcquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:148
ALIB_DLL void Acquire(ALIB_DBG_TAKE_CI)
Definition locks.cpp:119
#define ALIB_DBG_TAKE_CI
Definition alib.inl:1030
#define ALIB_CALLER
Definition alib.inl:1018
ALIB_DLL Lock STD_IOSTREAMS_LOCK
Definition locks.cpp:48
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
lang::CallerInfo CallerInfo
Type alias in namespace alib.
time::Ticks Ticks
Type alias in namespace alib.
Definition ticks.inl:79