jsMain.internal.Sharing.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-js Show documentation
Show all versions of kotlinx-coroutines-core-js Show documentation
Coroutines support libraries for Kotlin
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.internal
import kotlinx.coroutines.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@Suppress("ACTUAL_WITHOUT_EXPECT") // visibility different
internal actual typealias ShareableRefHolder = Any
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual fun ShareableRefHolder.disposeSharedRef() {}
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual fun T.asShareable(): DisposableHandle where T : DisposableHandle, T : ShareableRefHolder = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun CoroutineDispatcher.asShareable(): CoroutineDispatcher = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Continuation.asShareable() : Continuation = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Continuation.asLocal() : Continuation = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Continuation.asLocalOrNull() : Continuation? = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual fun Continuation.asLocalOrNullIfNotUsed() : Continuation? = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Continuation.useLocal() : Continuation = this
@Suppress("NOTHING_TO_INLINE") // Save an entry on call stack
internal actual inline fun Continuation.shareableInterceptedResumeCancellableWith(result: Result) {
intercepted().resumeCancellableWith(result)
}
@Suppress("NOTHING_TO_INLINE") // Save an entry on call stack
internal actual inline fun Continuation.shareableInterceptedResumeWith(result: Result) {
intercepted().resumeWith(result)
}
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun disposeContinuation(cont: () -> Continuation<*>) {}
@Suppress("NOTHING_TO_INLINE") // Save an entry on call stack
internal actual inline fun CancellableContinuationImpl.shareableResume(delegate: Continuation, useMode: Int) =
resumeImpl(delegate, useMode)
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun (suspend (T) -> R).asShareable(): suspend (T) -> R = this
@Suppress("NOTHING_TO_INLINE") // Save an entry on call stack
internal actual inline fun isReuseSupportedInPlatform() = true
internal actual inline fun ArrayList.addOrUpdate(element: T, update: (ArrayList) -> Unit) {
add(element)
}
internal actual inline fun ArrayList.addOrUpdate(index: Int, element: T, update: (ArrayList) -> Unit) {
add(index, element)
}
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Any.weakRef(): Any = this
@Suppress("NOTHING_TO_INLINE") // Should be NOP
internal actual inline fun Any?.unweakRef(): Any? = this
© 2015 - 2025 Weber Informatics LLC | Privacy Policy