withLock
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.
Usage:
val lock = reentrantLock()
lock.withLock {
// Critical section of code
}
Content copied to clipboard
Executes the given block of code while holding the specified ReentrantLock. This function simplifies the process of acquiring and releasing a lock safely.
Usage:
val lock = reentrantLock()
lock.withLock {
// Critical section of code
}
Content copied to clipboard