8#ifndef INCLUDED_BSLMT_READERWRITERLOCKASSERT
9#define INCLUDED_BSLMT_READERWRITERLOCKASSERT
393#include <bslscm_version.h>
397#include <bsl_string.h>
401#if defined(BSLS_ASSERT_IS_ACTIVE)
402 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED(rwLock_p) do { \
403 bslmt::ReaderWriterLockAssert_Imp::assertIsLocked( \
405 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED(" #rwLock_p ")", \
408 bsls::Assert::k_LEVEL_ASSERT); } while (false)
410 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED(rwLock_p) ((void) 0)
413#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
414 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_SAFE(rwLock_p) do { \
415 bslmt::ReaderWriterLockAssert_Imp::assertIsLocked( \
417 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_SAFE(" #rwLock_p ")", \
420 bsls::Assert::k_LEVEL_SAFE); } while (false)
422 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_SAFE(rwLock_p) ((void) 0)
425#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
426 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_OPT(rwLock_p) do { \
427 bslmt::ReaderWriterLockAssert_Imp::assertIsLocked( \
429 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_OPT(" #rwLock_p ")", \
432 bsls::Assert::k_LEVEL_OPT); } while (false)
434 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_OPT(rwLock_p) ((void) 0)
439#if defined(BSLS_ASSERT_IS_ACTIVE)
440 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ(rwLock_p) do { \
441 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedRead( \
443 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ(" #rwLock_p ")", \
446 bsls::Assert::k_LEVEL_ASSERT); } while (false)
448 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ(rwLock_p) ((void) 0)
451#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
452 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_SAFE(rwLock_p) do { \
453 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedRead( \
455 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_SAFE(" #rwLock_p ")", \
458 bsls::Assert::k_LEVEL_SAFE); } while (false)
460 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_SAFE(rwLock_p) \
464#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
465 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_OPT(rwLock_p) do { \
466 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedRead( \
468 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_OPT(" #rwLock_p ")", \
471 bsls::Assert::k_LEVEL_OPT); } while (false)
473 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_READ_OPT(rwLock_p) \
479#if defined(BSLS_ASSERT_IS_ACTIVE)
480 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE(rwLock_p) do { \
481 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedWrite( \
483 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE(" #rwLock_p ")", \
486 bsls::Assert::k_LEVEL_ASSERT); } while (false)
488 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE(rwLock_p) ((void) 0)
491#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
492 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_SAFE(rwLock_p) do { \
493 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedWrite( \
495 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_SAFE(" #rwLock_p ")", \
498 bsls::Assert::k_LEVEL_SAFE); } while (false)
500 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_SAFE(rwLock_p) \
504#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
505 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_OPT(rwLock_p) do { \
506 bslmt::ReaderWriterLockAssert_Imp::assertIsLockedWrite( \
508 "BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_OPT(" #rwLock_p ")", \
511 bsls::Assert::k_LEVEL_OPT); } while (false)
513 #define BSLMT_READERWRITERLOCKASSERT_IS_LOCKED_WRITE_OPT(rwLock_p) \
544 template <
class RW_LOCK>
562 template <
class RW_LOCK>
580 template <
class RW_LOCK>
602template <
class RW_LOCK>
616 if (!rwLock->isLocked()) {
622template <
class RW_LOCK>
636 if (!rwLock->isLockedRead()) {
642template <
class RW_LOCK>
656 if (!rwLock->isLockedWrite()) {
Definition bsls_assert.h:1929
static const char k_LEVEL_ASSERT[]
Definition bsls_assert.h:2046
static const char k_LEVEL_SAFE[]
Definition bsls_assert.h:2044
static BSLS_ASSERT_NORETURN_INVOKE_HANDLER void invokeHandler(const AssertViolation &violation)
static const char k_LEVEL_INVOKE[]
Definition bsls_assert.h:2047
static const char k_LEVEL_OPT[]
Definition bsls_assert.h:2045
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bslmt_barrier.h:344
Definition bslmt_readerwriterlockassert.h:529
static void assertIsLockedRead(RW_LOCK *rwLock, const char *text, const char *file, int line, const char *level)
Definition bslmt_readerwriterlockassert.h:624
static bool isValidLevel(const char *level)
Definition bslmt_readerwriterlockassert.h:663
static void assertIsLockedWrite(RW_LOCK *rwLock, const char *text, const char *file, int line, const char *level)
Definition bslmt_readerwriterlockassert.h:644
static void assertIsLocked(RW_LOCK *rwLock, const char *text, const char *file, int line, const char *level)
Definition bslmt_readerwriterlockassert.h:604