All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.internal.Concurrent.kt Maven / Gradle / Ivy

The newest version!
package kotlinx.coroutines.internal

import java.util.*
import kotlin.concurrent.withLock as withLockJvm

@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual typealias ReentrantLock = java.util.concurrent.locks.ReentrantLock

internal actual inline fun  ReentrantLock.withLock(action: () -> T) = this.withLockJvm(action)

@Suppress("ACTUAL_WITHOUT_EXPECT") // Visibility
internal actual typealias WorkaroundAtomicReference = java.util.concurrent.atomic.AtomicReference

// BenignDataRace is OptionalExpectation and doesn't have to be here
// but then IC breaks. See KT-66317
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.FIELD)
internal actual annotation class BenignDataRace()

@Suppress("NOTHING_TO_INLINE") // So that R8 can completely remove ConcurrentKt class
internal actual inline fun  identitySet(expectedSize: Int): MutableSet =
    Collections.newSetFromMap(IdentityHashMap(expectedSize))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy