Commit d9756c21 authored by Him188's avatar Him188

Add common `runBlocking` for convenience

parent a69d6e2e
package net.mamoe.mirai.utils.internal
import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext
/**
* Mirror of `runBlocking` from `kotlinx.serialization` on JVM
*/
internal actual fun <T> runBlocking(
context: CoroutineContext,
block: suspend CoroutineScope.() -> T
): T = kotlinx.coroutines.runBlocking(context, block)
\ No newline at end of file
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.utils.internal
import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
/**
* Mirror of `runBlocking` from `kotlinx.serialization` on JVM.
*/
internal expect fun <T> runBlocking(
context: CoroutineContext = EmptyCoroutineContext,
block: suspend CoroutineScope.() -> T
): T
\ No newline at end of file
package net.mamoe.mirai.utils.internal
import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext
/**
* Mirror of `runBlocking` from `kotlinx.serialization` on JVM.
*/
internal actual fun <T> runBlocking(
context: CoroutineContext,
block: suspend CoroutineScope.() -> T
): T = kotlinx.coroutines.runBlocking(context, block)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment