The builtin type autoLock: an object that keeps a lock and releases it
when destructed.
Put the object on the stack to make sure the destructor is called when
leaving the block. Otherwise it only happens when the garbage collector
finds the object unused, which may be much later.
Typical use:
{
autoLock %al = NEW(myLock)
# Do something that might crash
} # %al.Finish() calls myLock.end() here, always
|
NEW(lock) @public | Calls lock.begin().
|
|
$Finish()
status @public | Destructor: calls end() on the lock the object was created with.
| |
|