UCommon
Public Member Functions
ucommon::ThreadLock::guard_reader Class Reference

Guard class to apply scope based access locking to objects. More...

#include <thread.h>

Public Member Functions

 guard_reader ()
 Create an unitialized instance of guard. More...
 
 guard_reader (const void *object)
 Construct a guard for a specific object. More...
 
void operator= (const void *pointer)
 Set guard to read lock a new object. More...
 
void release (void)
 Prematurely release a guard.
 
void set (const void *object)
 Set guard to mutex lock a new object. More...
 
 ~guard_reader ()
 Release mutex when guard falls out of scope.
 

Detailed Description

Guard class to apply scope based access locking to objects.

The rwlock is located from the rwlock pool rather than contained in the target object, and the read lock is released when the guard object falls out of scope. This is essentially an automation mechanism for mutex::reader.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 542 of file thread.h.

Constructor & Destructor Documentation

ucommon::ThreadLock::guard_reader::guard_reader ( )

Create an unitialized instance of guard.

Usually used with a guard = operator.

ucommon::ThreadLock::guard_reader::guard_reader ( const void *  object)

Construct a guard for a specific object.

Parameters
objectto guard.

Member Function Documentation

void ucommon::ThreadLock::guard_reader::operator= ( const void *  pointer)
inline

Set guard to read lock a new object.

If a lock is currently held, it is released.

Parameters
pointerto object to guard.

Definition at line 582 of file thread.h.

void ucommon::ThreadLock::guard_reader::set ( const void *  object)

Set guard to mutex lock a new object.

If a lock is currently held, it is released.

Parameters
objectto guard.

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