Documentation for method
unlock assembled from the following types:
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
unlock. Failing that, use a
my = Lock.new;
method unlock(IO::Handle: --> True)
lock from the filehandle.
method unlock(Lock::Async: --> Nil)
Releases the lock. If there are any outstanding
Promises, 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
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;