ucommon

LockedPointer Class Reference

An object pointer that uses mutex to assure thread-safe singleton use. More...

#include <thread.h>

Inheritance diagram for LockedPointer:
Collaboration diagram for LockedPointer:

Protected Member Functions

Objectdup (void)
 Create a duplicate reference counted instance of the current object.
 LockedPointer ()
 Create an instance of a locked pointer.
void operator= (Object *object)
 Replace existing object through assignment.
void replace (Object *object)
 Replace existing object with a new one for next request.

Friends

class locked_release

Detailed Description

An object pointer that uses mutex to assure thread-safe singleton use.

This class is used to support a threadsafe replacable pointer to a object. This class is used to form and support the templated locked_pointer class and used with the locked_release class. An example of where this might be used is in config file parsers, where a seperate thread may process and generate a new config object for new threads to refernce, while the old configuration continues to be used by a reference counted instance that goes away when it falls out of scope.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1359 of file thread.h.


Member Function Documentation

Object* LockedPointer::dup ( void  ) [protected]

Create a duplicate reference counted instance of the current object.

Returns:
duplicate reference counted object.

Reimplemented in locked_pointer< T >.

void LockedPointer::operator= ( Object object) [inline, protected]

Replace existing object through assignment.

Parameters:
objectto assign.

Definition at line 1388 of file thread.h.

void LockedPointer::replace ( Object object) [protected]

Replace existing object with a new one for next request.

Parameters:
objectto register with pointer.

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