#include <garbagelock.h>
Public Member Functions | |
GarbageLock (const Item &itm) | |
Creates a garbage lock protecting an item. | |
GarbageLock () | |
Creates an empty garbage lock. | |
Item & | item () |
Return the guarded item. | |
const Item & | item () const |
Return the guarded item (const version). | |
~GarbageLock () | |
Releases the item that can now be collected. | |
Friends | |
class | MemPool |
This class safely store an item, and all its contents in case it is a sort of container, from being collected. The garbage locked items are marked as soon as they reach the lowest possible value in the live generation count. Extensions are granted to have their gcMark() method called when this happens, so any kind of item can be safely stored as the item() element.
Once destroyed, the garbage lock releases the item, that can then be immediately collected.
Falcon::GarbageLock::GarbageLock | ( | ) |
Creates an empty garbage lock.
The item inside this garbage lock is nil.
Falcon::GarbageLock::GarbageLock | ( | const Item & | itm | ) |
Creates a garbage lock protecting an item.
Falcon::GarbageLock::~GarbageLock | ( | ) |
Releases the item that can now be collected.
Item& Falcon::GarbageLock::item | ( | ) | [inline] |
Return the guarded item.
The returned value can be modified. For example, setting it to nil or to another flat value will cause the previously guarded value to be released, and collectible for garbage.
const Item& Falcon::GarbageLock::item | ( | ) | const [inline] |
Return the guarded item (const version).
friend class MemPool [friend] |