17 lines
378 B
Kotlin
17 lines
378 B
Kotlin
package net.sergeych.synctools
|
|
|
|
import kotlinx.atomicfu.locks.ReentrantLock
|
|
|
|
/**
|
|
* Native implementation uses `ReentrantLock`]
|
|
*/
|
|
actual fun ProtectedOp(): ProtectedOpImplementation = object : ProtectedOpImplementation {
|
|
private val access = ReentrantLock()
|
|
override fun lock() {
|
|
access.lock()
|
|
}
|
|
|
|
override fun unlock() {
|
|
access.unlock()
|
|
}
|
|
} |