PWriteLocker Class Reference

Detailed Description

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

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

Definition at line 31 of file PWriteLocker.h.

#include <PWriteLocker.h>

Constructor & Destructor Documentation

◆ PWriteLocker()

PWriteLocker::PWriteLocker ( PReadWriteLock lock)

Constructs a PWriteLocker and locks lock for writing.

The lock will be unlocked when the PReadLocker is destroyed.

◆ ~PWriteLocker()

virtual PWriteLocker::~PWriteLocker ( )
virtual

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