You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trySendBlocking() is only available in Kotlin/JVM. But the implementation doesn't seem to have any JVM-specific requirements. Copying the extension function to a KMM shared module compiles just fine, only warning about InternalCoroutinesApi usage in ChannelResult:
@Throws(InterruptedException::class)
public fun <E> SendChannel<E>.trySendBlocking(element: E): ChannelResult<Unit> {
trySend(element).onSuccess { return ChannelResult.success(Unit) }
return runBlocking {
val r = runCatching { send(element) }
if (r.isSuccess) ChannelResult.success(Unit)
else ChannelResult.closed(r.exceptionOrNull())
}
}
Can this function be added to support Kotlin/Native?
The deprecated sendBlocking() function that functions similarly is available, but can't be replaced with trySendBlocking() as it suggests.
The text was updated successfully, but these errors were encountered:
NOTE: This is a mirror for the https://youtrack.jetbrains.com/issue/KT-49230, made to follow the kotlinx.coroutines Contributing Guidelines.
All the credits should go to @jeffdgr8(I hope I'm not mentioning the wrong person).
trySendBlocking()
is only available in Kotlin/JVM. But the implementation doesn't seem to have any JVM-specific requirements. Copying the extension function to a KMM shared module compiles just fine, only warning aboutInternalCoroutinesApi
usage inChannelResult
:Can this function be added to support Kotlin/Native?
The deprecated
sendBlocking()
function that functions similarly is available, but can't be replaced withtrySendBlocking()
as it suggests.The text was updated successfully, but these errors were encountered: