![JAR search and dependency download from the Maven repository](/logo.png)
jsAndWasmSharedMain.internal.Concurrent.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-coroutines-core
Show all versions of kotlinx-coroutines-core
Coroutines support libraries for Kotlin
package kotlinx.coroutines.internal
internal actual typealias ReentrantLock = NoOpLock
internal actual inline fun ReentrantLock.withLock(action: () -> T) = action()
internal class NoOpLock {
fun tryLock() = true
fun unlock(): Unit {}
}
internal actual fun identitySet(expectedSize: Int): MutableSet = HashSet(expectedSize)
internal actual class WorkaroundAtomicReference actual constructor(private var value: V) {
public actual fun get(): V = value
public actual fun set(value: V) {
this.value = value
}
public actual fun getAndSet(value: V): V {
val prev = this.value
this.value = value
return prev
}
public actual fun compareAndSet(expected: V, value: V): Boolean {
if (this.value === expected) {
this.value = value
return true
}
return false
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy