ReentrantLock
ReentrantLock from kotlinx.atomicfu.locks
ReentrantLock is designed for delegation. You write val lock = reentrantLock() to construct its instance and use lock/tryLock/unlock functions or lock.withLock { ... } extension function similarly to the way jucl.ReentrantLock is used on JVM. On JVM it is a typealias to the later class, erased on JS.
ReentrantLock from kotlinx.atomicfu.locks
ReentrantLock is designed for delegation. You write val lock = reentrantLock() to construct its instance and use lock/tryLock/unlock functions or lock.withLock { ... } extension function similarly to the way jucl.ReentrantLock is used on JVM. On JVM it is a typealias to the later class, erased on JS.
ReentrantLock from kotlinx.atomicfu.locks
ReentrantLock is designed for delegation. You write val lock = reentrantLock() to construct its instance and use lock/tryLock/unlock functions or lock.withLock { ... } extension function similarly to the way jucl.ReentrantLock is used on JVM. On JVM it is a typealias to the later class, erased on JS.
ReentrantLock from kotlinx.atomicfu.locks
ReentrantLock is designed for delegation. You write val lock = reentrantLock() to construct its instance and use lock/tryLock/unlock functions or lock.withLock { ... } extension function similarly to the way jucl.ReentrantLock is used on JVM. On JVM it is a typealias to the later class, erased on JS.
Functions
Attempts to acquire the lock. If the lock is available, it will be acquired, and this function will return true. If the lock is already held by another thread, this function will return false immediately without blocking.
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.