Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
d9756c21
Commit
d9756c21
authored
Apr 08, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add common `runBlocking` for convenience
parent
a69d6e2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
...Main/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
+12
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/runBlocking.common.kt
...tlin/net.mamoe.mirai/utils/internal/runBlocking.common.kt
+22
-0
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
...Main/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
+12
-0
No files found.
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
0 → 100644
View file @
d9756c21
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
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/runBlocking.common.kt
0 → 100644
View file @
d9756c21
/*
* 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
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt
0 → 100644
View file @
d9756c21
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment