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;
151#if defined(BSLS_PLATFORM_OS_AIX) || defined(BSLMT_PLATFORM_WIN32_THREADS)
222#ifdef BSLMT_PLATFORM_POSIX_THREADS
232 const int rc = pthread_rwlock_init(&d_lock, NULL);
242RWMutexImpl<bslmt::Platform::PosixThreads>::~RWMutexImpl()
244 const int rc = pthread_rwlock_destroy(&d_lock);
255RWMutexImpl<bslmt::Platform::PosixThreads>::lockRead()
257 const int rc = pthread_rwlock_rdlock(&d_lock);
267RWMutexImpl<bslmt::Platform::PosixThreads>::lockWrite()
269 const int rc = pthread_rwlock_wrlock(&d_lock);
279RWMutexImpl<bslmt::Platform::PosixThreads>::tryLockRead()
281 return pthread_rwlock_tryrdlock(&d_lock) ? 1 : 0;
286RWMutexImpl<bslmt::Platform::PosixThreads>::tryLockWrite()
288 return pthread_rwlock_trywrlock(&d_lock) ? 1 : 0;
293RWMutexImpl<bslmt::Platform::PosixThreads>::unlock()
295 pthread_rwlock_unlock(&d_lock);
331 return d_impl.tryLockRead();
337 return d_impl.tryLockWrite();
Definition bslmt_rwmutex.h:148
int tryLockWrite()
Definition bslmt_rwmutex.h:335
int tryLockRead()
Definition bslmt_rwmutex.h:329
RWMutex()
Create an RW mutex initialized to an unlocked state.
Definition bslmt_rwmutex.h:306
~RWMutex()
Definition bslmt_rwmutex.h:311
void lockRead()
Definition bslmt_rwmutex.h:317
void unlock()
Definition bslmt_rwmutex.h:341
void lockWrite()
Definition bslmt_rwmutex.h:323
Definition bslmt_readerwriterlock.h:294
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:2101
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslmt_barrier.h:344
Definition bslmt_rwmutex.h:93