ucommon
Public Member Functions
ucommon::ThreadLock::guard_writer Class Reference

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

#include <thread.h>

Public Member Functions

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

Detailed Description

Guard class to apply scope based exclusive locking to objects.

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

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 567 of file thread.h.


Constructor & Destructor Documentation

Create an unitialized instance of guard.

Usually used with a guard = operator.

Construct a guard for a specific object.

Parameters:
objectto guard.

Member Function Documentation

void ucommon::ThreadLock::guard_writer::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 607 of file thread.h.

void ucommon::ThreadLock::guard_writer::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: