INOS
|
#include <inos_syn.h>
Public Member Functions | |
CINOSRefCount (const char *apParentName, const char *apBaseName, int32 aiInitialCount=0, void *apHandlerObj=NULL, void *apHandlerFunc=NULL) | |
Create a reference counter with the given name. | |
virtual | ~CINOSRefCount () |
Destroy reference counter. | |
int32 | Increment () |
Increment the reference counter and return the new value. | |
int32 | Decrement () |
Decrement the reference counter and return the new value. | |
int32 | GetCount () |
Get current count. | |
void | SetCount (int32 aiNewCount) |
Set current count. | |
Protected Member Functions | |
uint32 | Request () |
void | Release () |
DECLARE_DYNAMIC (CINOSRefCount) | |
Protected Attributes | |
inosName32 | m_sName |
Reference counter name (for debugging purposes) | |
int32 | m_iCount |
Reference count. | |
void * | m_pHandlerObj |
Handler method to call when count reaches 0. | |
void * | m_pHandlerFunc |
Friends | |
class | CINOSLockGuard< CINOSRefCount > |
interface required for CINOSLockGuard | |
This class implements a thread-safe reference counter that can be used to call some member function every time the counter is decremented to 0.
CINOSRefCount::CINOSRefCount | ( | const char * | apParentName, |
const char * | apBaseName, | ||
int32 | aiInitialCount = 0 , |
||
void * | apHandlerObj = NULL , |
||
void * | apHandlerFunc = NULL |
||
) |
Create a reference counter with the given name.
apParentName | Name of parent object |
apBaseName | Name of reference counter object |
auInitialCount | Requested initial count |