acquire

suspend fun acquire(node: AbstractQueuedSynchronizer.Node?, arg: Int, shared: Boolean, interruptible: Boolean, timed: Boolean, time: Long): Int

Main acquire method, invoked by all exported acquire methods.

Return

positive if acquired, 0 if timed out, negative if interrupted

Parameters

node

null unless a reacquiring Condition

arg

the acquire argument

shared

true if shared mode else exclusive

interruptible

if abort and return negative on interrupt

timed

if true use timed waits

time

if timed, the System.nanoTime value to timeout


suspend fun acquire(arg: Int)

Acquires in exclusive mode, ignoring interrupts. Implemented by invoking at least once .tryAcquire, returning on success. Otherwise the thread is queued, possibly repeatedly blocking and unblocking, invoking .tryAcquire until success. This method can be used to implement method Lock.lock.

Parameters

arg

the acquire argument. This value is conveyed to .tryAcquire but is otherwise uninterpreted and can represent anything you like.