tryAcquireSharedNanos

suspend fun tryAcquireSharedNanos(arg: Int, nanosTimeout: Long): Boolean

Attempts to acquire in shared mode, aborting if interrupted, and failing if the given timeout elapses. Implemented by first checking interrupt status, then invoking at least once .tryAcquireShared, returning on success. Otherwise, the thread is queued, possibly repeatedly blocking and unblocking, invoking .tryAcquireShared until success or the thread is interrupted or the timeout elapses.

Return

true if acquired; false if timed out

Parameters

arg

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

nanosTimeout

the maximum number of nanoseconds to wait

Throws

if the current thread is interrupted