DCMTK  Version 3.6.1 20170228
OFFIS DICOM Toolkit
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OFReadWriteLocker Class Reference

This class aims to provide an easy way for making sure OFReadWriteLocks are unlocked in an exception safe way. More...

Public Member Functions

 OFReadWriteLocker (OFReadWriteLock &lock)
 constructor More...
 
 ~OFReadWriteLocker ()
 destructor, unlocks the mutex if necessary
 
int rdlock ()
 lock the lock for reading More...
 
int wrlock ()
 lock the lock for writing More...
 
int tryrdlock ()
 try to lock the lock for reading More...
 
int trywrlock ()
 try to lock the lock for writing More...
 
int unlock ()
 unlock the lock More...
 

Private Member Functions

 OFReadWriteLocker (const OFReadWriteLocker &arg)
 unimplemented private copy constructor
 
OFReadWriteLockeroperator= (const OFReadWriteLocker &arg)
 unimplemented private assignment operator
 

Private Attributes

OFReadWriteLocktheLock
 the lock on which we are operating
 
OFBool locked
 did we successfully lock the lock?
 

Detailed Description

This class aims to provide an easy way for making sure OFReadWriteLocks are unlocked in an exception safe way.

You can just create a local instance of this class and lock the OFReadWriteLock through it. When it is destructed it will make sure that the lock is unlocked if necessary.

Constructor & Destructor Documentation

OFReadWriteLocker::OFReadWriteLocker ( OFReadWriteLock lock)

constructor

Parameters
lockthe lock to associate this instance with

Member Function Documentation

int OFReadWriteLocker::rdlock ( )

lock the lock for reading

Returns
0 upon success, an error code otherwise
See also
OFReadWriteLock::rdlock
int OFReadWriteLocker::tryrdlock ( )

try to lock the lock for reading

Returns
0 upon success, OFReadWriteLock::busy if the read/write lock is already locked, an error code otherwise
See also
OFReadWriteLock::tryrdlock
int OFReadWriteLocker::trywrlock ( )

try to lock the lock for writing

Returns
0 upon success, OFReadWriteLock::busy if the read/write lock is already locked, an error code otherwise
See also
OFReadWriteLock::trywrlock
int OFReadWriteLocker::unlock ( )

unlock the lock

Returns
0 upon success, an error code otherwise
See also
OFReadWriteLock::unlock
int OFReadWriteLocker::wrlock ( )

lock the lock for writing

Returns
0 upon success, an error code otherwise
See also
OFReadWriteLock::wrlock

The documentation for this class was generated from the following file:


Generated on Tue Feb 28 2017 for DCMTK Version 3.6.1 20170228 by Doxygen 1.8.8