18 lines
404 B
Kotlin
18 lines
404 B
Kotlin
package net.sergeych.synctools
|
|
|
|
import java.util.concurrent.locks.ReentrantLock
|
|
|
|
/**
|
|
* Android actual implementation mirrors JVM using [ReentrantLock].
|
|
*/
|
|
actual fun ProtectedOp(): ProtectedOpImplementation = object : ProtectedOpImplementation {
|
|
private val access = ReentrantLock()
|
|
override fun lock() {
|
|
access.lock()
|
|
}
|
|
|
|
override fun unlock() {
|
|
access.unlock()
|
|
}
|
|
}
|