My Project
Public Member Functions
Checkable_rwlock Class Reference

#include <rpl_gtid.h>

List of all members.

Public Member Functions

 Checkable_rwlock ()
 Initialize this Checkable_rwlock.
 ~Checkable_rwlock ()
 Destroy this Checkable_lock.
void rdlock ()
 Acquire the read lock.
void wrlock ()
 Acquire the write lock.
void unlock ()
 Release the lock (whether it is a write or read lock).
bool is_wrlock ()
void assert_some_lock () const
 Assert that some thread holds either the read or the write lock.
void assert_some_rdlock () const
 Assert that some thread holds the read lock.
void assert_some_wrlock () const
 Assert that some thread holds the write lock.
void assert_no_wrlock () const
 Assert that no thread holds the write lock.
void assert_no_rdlock () const
 Assert that no thread holds the read lock.
void assert_no_lock () const
 Assert that no thread holds read or write lock.

Detailed Description

This has the functionality of mysql_rwlock_t, with two differences: 1. It has additional operations to check if the read and/or write lock is held at the moment. 2. It is wrapped in an object-oriented interface.

Note that the assertions do not check whether *this* thread has taken the lock (that would be more complicated as it would require a dynamic data structure). Luckily, it is still likely that the assertions find bugs where a thread forgot to take a lock, because most of the time most locks are only used by one thread at a time.

The assertions are no-ops when DBUG is off.

Member Function Documentation

bool Checkable_rwlock::is_wrlock ( ) [inline]

Return true if the write lock is held. Must only be called by threads that hold a lock.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines