List of all members.
Call AcquirePointer method to get counted pointer to this object. Deleting by delete operator is not allowed, use Release method instead. AcquirePointer can return
NULL if object has been deleted from another thread in the same time.
Object is not deleted from memory until number of pointers is zero. This is usefull if you want to be sure that your object still exists.
This class is thread-safe execpt one case - the absotelly last deleted object. It must be deleted safetely from one thread and no other thread can acquire pointer simultaneously. This is provided by root node in KernelServer in our engine.
Counted *p = new Counted(); // create object (first conted pointer is set) Counted *cp1 = p->AcquirePointer(); // get next counted pointer Counted *cp2 = p->AcquirePointer(); // get another counted opinter p->Release(); // object is not deleted from memory, only number of counted pointers is decreased cp1->Release(); // object still exists cp2->Release(); // now the object is deleted from memory
Public Member Functions
|Counted *||AcquirePointer ()|
|virtual bool||Release ()|
Protected Member Functions
Static Protected Member Functions
|static void||LockCounted ()|
|static void||UnlockCounted ()|
|Number of pointers to this object. |
Static Private Attributes
|static uint_t||instances_count = 0|
|Number of all instances of Counted object. |
|static Mutex *||counted_mutex = NULL|
|Mutex for changing pointers count. |
|Counted * Counted::AcquirePointer||(||)||