Note: This class is not available with the PO_NO_THREAD_CLASSES parse option.
This is an abstract class to be inherited by builtin classes that implement the internal Qore API that allows them to be used by the Condition class. Currently the RWLock and Mutex classes inherit this class.
This class cannot be instantiated directly and also cannot be directly inherited by user-defined classes.
Table 4.715. AbstractSmartLock Method Overview
Method | Except? | Description |
|---|---|---|
Y | Throws an exception if called directly; this class can only be instantiated by builtin subclasses. | |
N | Performs no action. | |
N | Performs no action. | |
N | Returns the name of the threading class directly inheriting this class. | |
N | Returns True if the calling thread owns the lock, False if not. | |
N | Returns the TID of the thread owning the lock or -1 if the lock is currently not acquired. |
Throws an exception if called directly or if inherited by a user-defined class; this class can only be instantiated by builtin subclasses.
Table 4.716. Exceptions Thrown by AbstractSmartLock::constructor()
err | desc |
|---|---|
| This class cannot be instantiated directly or inherited by user code. |
Returns the name of the threading class directly inheriting this class.
my $name = $lock.getName();Table 4.717. Return Values for AbstractSmartLock::getName()
Return Type | Description |
|---|---|
Returns the name of the threading class directly inheriting this class. |
Returns True if the calling thread owns the lock, False if not.
# only grab and release lock if we don't already own it if (!$lock.lockOwner()) $lock.lock(); on_exitif (!$lock.lockOwner()) $lock.unlock();
Table 4.718. Return Values for AbstractSmartLock::lockOwner()
Return Type | Description |
|---|---|
Returns True if the calling thread owns the lock, False if not. |
Returns the TID of the thread owning the lock or -1 if the lock is currently not acquired.
This method normally not useful in practice for anything except checking that the current thread owns the lock, in which case AbstractSmartLock::lockOwner() is better, because if the lock is not owned by the current thread the lock ownership can change at any time.
my int $tid = $lock.lockTID();Table 4.719. Return Values for AbstractSmartLock::lockTID()
Return Type | Description |
|---|---|
Returns the TID of the thread owning the lock or -1 if the lock is currently not acquired. |
There are no comments yet