Class Poco::RWLock
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco

# class RWLock

Library: Foundation
Package: Threading
Header: Poco/RWLock.h

## Description

A reader writer lock allows multiple concurrent readers or one exclusive writer.

## Inheritance

Direct Base Classes: RWLockImpl

All Base Classes: RWLockImpl

## Member Summary

Member Functions: readLock, tryReadLock, tryWriteLock, unlock, writeLock

## Types

### ScopedLock

typedef ScopedRWLock ScopedLock;

### ScopedReadLock

typedef ScopedReadRWLock ScopedReadLock;

### ScopedWriteLock

typedef ScopedWriteRWLock ScopedWriteLock;

## Constructors

### RWLock

RWLock();

Creates the Reader/Writer lock.

## Destructor

### ~RWLock

~RWLock();

Destroys the Reader/Writer lock.

## Member Functions

### readLock

void readLock();

Acquires a read lock. If another thread currently holds a write lock, waits until the write lock is released.

### tryReadLock

bool tryReadLock();

Tries to acquire a read lock. Immediately returns true if successful, or false if another thread currently holds a write lock.

### tryWriteLock

bool tryWriteLock();

Tries to acquire a write lock. Immediately returns true if successful, or false if one or more other threads currently hold locks. The result is undefined if the same thread already holds a read or write lock.

### unlock

void unlock();

Releases the read or write lock.

### writeLock

void writeLock();

Acquires a write lock. If one or more other threads currently hold locks, waits until all locks are released. The results are undefined if the same thread already holds a read or write lock