In Lock§
See primary documentation in context for method unlock
method unlock(Lock:)
Releases the lock.
my = Lock.new;.lock;.unlock;
It is important to make sure the Lock
is always released, even if an exception is thrown. The safest way to ensure this is to use the protect
method, instead of explicitly calling lock
and unlock
. Failing that, use a LEAVE
phaser.
my = Lock.new;
In IO::CatHandle§
See primary documentation in context for method unlock
method unlock(IO::CatHandle:)
Same as IO::Handle.unlock
. Returns Nil
if the source handle queue has been exhausted.
Unlocks only the currently active source handle. The .on-switch
Callable
can be used to conveniently lock/unlock the handles as they're being processed by the CatHandle.
In Lock::Async§
See primary documentation in context for method unlock
method unlock(Lock::Async: --> Nil)
Releases the lock. If there are any outstanding lock
Promise
s, the one at the head of the queue will then be kept, and potentially code scheduled on the thread pool (so the cost of calling unlock
is limited to the work needed to schedule another piece of code that wants to obtain the lock, but not to execute that code).
my = Lock::Async.new;await .lock;.unlock;
Prefer to use protect instead of explicit calls to lock
and unlock
. However, if wishing to use the methods separately, it is wise to use a LEAVE
block to ensure that unlock
is reliably called. Failing to unlock
will mean that nobody can ever lock
this particular Lock::Async
instance again.
my = Lock::Async.new;
In IO::Handle§
See primary documentation in context for method unlock
method unlock(IO::Handle: --> True)
Removes a lock
from the filehandle. It will return True
or fail with an exception if it's not possible.