envzn
0.8 · beta · not released

Library / Concurrency / Synchronisation / Mutex

CLASS

Mutex

Fields 1

T data

Constructors 1

INIT(REFERENCE T initial)

Methods 3

MODIFY METHOD acquire() RETURNS void
modifies

Block until the lock is acquired. Mirrors Lock.acquire(). Use through SYNCHRONIZED in user code — manual acquire is the C-mutex anti-pattern (forget release, leak the lock).

MODIFY METHOD release() RETURNS void
modifies

Release the lock. Mirrors Lock.release(). Pairs with a previous acquire() on the same Mutex from the same thread.

MODIFY METHOD tryAcquire() RETURNS boolean
modifies

Non-blocking attempt to acquire. Mirrors Lock.tryAcquire(). Returns TRUE if the caller now holds the lock (and is responsible for calling release() exactly once); FALSE if another thread currently holds it.