A mutex locked object smart pointer helper class. More...
#include <thread.h>
Public Member Functions | |
auto_protect (const void *object) | |
Construct a protected pointer referencing an existing object. | |
operator bool () const | |
Test if the pointer is referencing an object. | |
bool | operator! () const |
Test if the pointer is not set. | |
void | operator= (const void *object) |
Set our pointer to a specific object. | |
void | release (void) |
Manually release the pointer. | |
~auto_protect () | |
Delete protected pointer. | |
Protected Attributes | |
const void * | object |
A mutex locked object smart pointer helper class.
This is particularly useful in referencing objects which will be protected by the mutex protect function. When the pointer falls out of scope, the protecting mutex is also released. This is meant to be used by the typed mutex_pointer template.
Definition at line 1058 of file thread.h.
ucommon::auto_protect::auto_protect | ( | const void * | object | ) |
Construct a protected pointer referencing an existing object.
object | we point to. |
ucommon::auto_protect::~auto_protect | ( | ) |
Delete protected pointer.
When it falls out of scope the associated mutex is released.
ucommon::auto_protect::operator bool | ( | ) | const [inline] |
bool ucommon::auto_protect::operator! | ( | ) | const [inline] |
void ucommon::auto_protect::operator= | ( | const void * | object | ) |
void ucommon::auto_protect::release | ( | void | ) |
Manually release the pointer.
This releases the mutex.