PReadLocker Class Reference

Detailed Description

The PReadLocker class is a convenience class that simplifies locking and unlocking read-write locks for read access.

The purpose of PReadLocker (and PWriteLocker) is to simplify PReadWriteLock locking and unlocking. Locking and unlocking statements or in exception handling code is error-prone and difficult to debug. PReadLocker can be used in such situations to ensure that the state of the lock is always well-defined.

Definition at line 31 of file PReadLocker.h.

#include <PReadLocker.h>

Constructor & Destructor Documentation

◆ PReadLocker()

PReadLocker::PReadLocker ( PReadWriteLock lock)

Constructs a PReadLocker and locks lock for reading.

The lock will be unlocked when the PReadLocker is destroyed.

◆ ~PReadLocker()

virtual PReadLocker::~PReadLocker ( )

Destroys this object and unlocks the mutex that was locked in the constructor.