8#ifndef INCLUDED_BSLMT_RWMUTEX
9#define INCLUDED_BSLMT_RWMUTEX
73#include <bslscm_version.h>
80#if defined(BSLMT_PLATFORM_WIN32_THREADS) || defined(BSLS_PLATFORM_OS_AIX)
84#ifdef BSLMT_PLATFORM_POSIX_THREADS
87#include <bsl_cstddef.h>
92template <
class THREAD_POLICY>
97#ifdef BSLMT_PLATFORM_POSIX_THREADS
114 pthread_rwlock_t d_lock;
150#if defined(BSLS_PLATFORM_OS_AIX) || defined(BSLMT_PLATFORM_WIN32_THREADS)
214#ifdef BSLMT_PLATFORM_POSIX_THREADS
224 const int rc = pthread_rwlock_init(&d_lock, NULL);
234RWMutexImpl<bslmt::Platform::PosixThreads>::~RWMutexImpl()
236 const int rc = pthread_rwlock_destroy(&d_lock);
247RWMutexImpl<bslmt::Platform::PosixThreads>::lockRead()
249 const int rc = pthread_rwlock_rdlock(&d_lock);
259RWMutexImpl<bslmt::Platform::PosixThreads>::lockWrite()
261 const int rc = pthread_rwlock_wrlock(&d_lock);
271RWMutexImpl<bslmt::Platform::PosixThreads>::tryLockRead()
273 return pthread_rwlock_tryrdlock(&d_lock) ? 1 : 0;
278RWMutexImpl<bslmt::Platform::PosixThreads>::tryLockWrite()
280 return pthread_rwlock_trywrlock(&d_lock) ? 1 : 0;
285RWMutexImpl<bslmt::Platform::PosixThreads>::unlock()
287 pthread_rwlock_unlock(&d_lock);
323 return d_impl.tryLockRead();
329 return d_impl.tryLockWrite();
Definition bslmt_rwmutex.h:147
int tryLockWrite()
Definition bslmt_rwmutex.h:327
int tryLockRead()
Definition bslmt_rwmutex.h:321
RWMutex()
Create an RW mutex initialized to an unlocked state.
Definition bslmt_rwmutex.h:298
~RWMutex()
Definition bslmt_rwmutex.h:303
void lockRead()
Definition bslmt_rwmutex.h:309
void unlock()
Definition bslmt_rwmutex.h:333
void lockWrite()
Definition bslmt_rwmutex.h:315
Definition bslmt_readerwriterlock.h:294
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:1895
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bslmt_barrier.h:344
Definition bslmt_rwmutex.h:93