type

Lock

src const class Lock : Obj

Lock for synchronization between actors.

methods

lock

Acquire the lock; if not available then block forever until its available.

makeReentrant

Construct mutual exclusion lock.

tryLock

Acquire the lock if its free and immediately return true.

unlock

Release the lock.

Slot Details

lock

src Void lock()

Acquire the lock; if not available then block forever until its available.

makeReentrant

src static Lock makeReentrant()

Construct mutual exclusion lock.

tryLock

src Bool tryLock(Duration? timeout := null)

Acquire the lock if its free and immediately return true. Or if the lock is not available and timeout is null, then immediately return false. If timeout is non-null, then block up to the given timeout waiting for the lock and return true if lock acquired or false on timeout.

unlock

src Void unlock()

Release the lock. Raise exception if not holding the lock.