#include <safecoll.h>
Inheritance diagram for PSafeCollection:
Operations | |
virtual void | RemoveAll () |
virtual void | DeleteObjectsToBeRemoved () |
virtual void | SetAutoDeleteObjects () |
PINDEX | GetSize () const |
const PMutex & | GetMutex () const |
virtual BOOL | SafeRemove (PSafeObject *obj) |
virtual BOOL | SafeRemoveAt (PINDEX idx) |
Public Member Functions | |
Construction | |
PSafeCollection (PCollection *collection) | |
~PSafeCollection () | |
Protected Member Functions | |
void | SafeRemoveObject (PSafeObject *obj) |
PDECLARE_NOTIFIER (PTimer, PSafeCollection, DeleteObjectsTimeout) | |
Protected Attributes | |
PCollection * | collection |
PMutex | collectionMutex |
PAbstractList | toBeRemoved |
PMutex | removalMutex |
PTimer | deleteObjectsTimer |
This is part of a set of classes to solve the general problem of a collection (eg a PList or PDictionary) of objects that needs to be a made thread safe. Any thread can add, read, write or remove an object with both the object and the database of objects itself kept thread safe.
See the PSafeObject class for more details. Especially in regard to enumeration of collections.
|
Create a thread safe collection of objects. Note the collection is automatically deleted on destruction.
|
|
Destroy the thread safe collection. The will delete the collection object provided in the constructor. |
|
Delete any objects that have been removed. |
|
Get the mutex for the collection. |
|
Get the current size of the collection. Note that use of this function is limited as it is not subject to the collections mutual exclusion locking. Thus, it is merely an instantaneous snapshot of the state of the collection. |
|
|
|
Remove all objects in collection. |
|
Remove an object to the collection. This function removes the object from the collection itself, but does not actually delete the object. It simply moves the object to a list of objects to be garbage collected at a later time. As for Append() full mutual exclusion locking on the collection itself is maintained.
|
|
Remove an object to the collection. This function removes the object from the collection itself, but does not actually delete the object. It simply moves the object to a list of objects to be garbage collected at a later time. As for Append() full mutual exclusion locking on the collection itself is maintained.
|
|
|
|
Start a timer to automatically call DeleteObjectsToBeRemoved(). |
|
|
|
|
|
|
|
|
|
|