ULAPI
8.0
|
ULLockable can be used as a parent class for any class whose operations need to be made atomic in a threaded context. More...
#include <ullockable.h>
Public Member Functions | |
ULLockable () | |
ULLockable (const ULLockable &lockable) | |
virtual | ~ULLockable () |
const ULLockable & | operator= (const ULLockable &lockable) |
void | clear () |
ULLock * | getLock () |
void | setLock (ULLock *newLock) |
Protected Attributes | |
ULLock * | lock |
ULLockable can be used as a parent class for any class whose operations need to be made atomic in a threaded context.
Each ULLockable object has a pointer to a ULLock, which may be null (in which case no locking operations will take place) or point to some instance of a subclass of ULLock suitable for the platform on which the code is running.
ULLockable depends on ULScopeLocker, which implements a variant of the "Scoped Locking" pattern (http://www.cs.wustl.edu/~schmidt/PDF/ScopedLocking.pdf).
A typical use of a ULLockable object would involve steps like this:
MyClass
from ULLockable
MyClass
object, call setLock
with a pointer to a suitable instance of some child of ULLock. MyClass
that you want locked. MyClass
object will never delete the ULLock object, so the lock needs to be deleted elsewhere. (See ULFactory for a safe way of handling locks and memory in ULAPI.) ULLockable::ULLockable | ( | ) |
Default constructor.
ULLockable::ULLockable | ( | const ULLockable & | lockable | ) |
Copy constructor.
|
virtual |
Destructor.
void ULLockable::clear | ( | ) |
Initializes this object to its default state (i.e. no ULLock is assigned to it).
ULLock * ULLockable::getLock | ( | ) |
Accessor for the ULLock object associated with this ULLockable object.
const ULLockable & ULLockable::operator= | ( | const ULLockable & | lockable | ) |
Assignment operator.
void ULLockable::setLock | ( | ULLock * | newLock | ) |
Accessor for the ULLock object associated with this ULLockable object.
|
protected |