Skip to content

Commit bddb1d7

Browse files
committed
MPP: Remove runBlocking & EventLoop from common module
1 parent d164f73 commit bddb1d7

File tree

6 files changed

+6
-28
lines changed

6 files changed

+6
-28
lines changed

common/kotlinx-coroutines-core-common/src/main/kotlin/kotlinx/coroutines/experimental/CommonBuilders.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,3 @@ public expect suspend fun <T> withContext(
3333
start: CoroutineStart = CoroutineStart.DEFAULT,
3434
block: suspend () -> T
3535
): T
36-
37-
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
38-
public expect fun <T> runBlocking(
39-
context: CoroutineContext = EmptyCoroutineContext,
40-
block: suspend CoroutineScope.() -> T): T

common/kotlinx-coroutines-core-common/src/main/kotlin/kotlinx/coroutines/experimental/CommonEventLoop.kt

Lines changed: 0 additions & 19 deletions
This file was deleted.

core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Builders.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public suspend fun <T> run(context: CoroutineContext, block: suspend () -> T): T
164164
* @param block the coroutine code.
165165
*/
166166
@Throws(InterruptedException::class)
167-
public actual fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T {
167+
public fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T {
168168
val currentThread = Thread.currentThread()
169169
val eventLoop = if (context[ContinuationInterceptor] == null) BlockingEventLoop(currentThread) else null
170170
val newContext = newCoroutineContext(context + (eventLoop ?: EmptyCoroutineContext))

core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/EventLoop.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import kotlin.coroutines.experimental.CoroutineContext
3131
* It may optionally implement [Delay] interface and support time-scheduled tasks. It is used by [runBlocking] to
3232
* continue processing events when invoked from the event dispatch thread.
3333
*/
34-
public actual interface EventLoop {
34+
public interface EventLoop {
3535
/**
3636
* Processes next event in this event loop.
3737
*

js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental/Builders.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ public actual suspend fun <T> withContext(
122122
*
123123
* @param context context of the coroutine. The default value is an implementation of [EventLoop].
124124
* @param block the coroutine code.
125+
* @suppress JS Platform: **This is unstable API and it is subject to change.**
125126
*/
126-
public actual fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T {
127+
public fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T {
127128
val eventLoop = if (context[ContinuationInterceptor] == null) BlockingEventLoop() else null
128129
val newContext = newCoroutineContext(context + (eventLoop ?: EmptyCoroutineContext))
129130
val coroutine = BlockingCoroutine<T>(newContext, privateEventLoop = eventLoop != null)

js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental/EventLoop.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import kotlin.coroutines.experimental.CoroutineContext
2525
*
2626
* It may optionally implement [Delay] interface and support time-scheduled tasks. It is used by [runBlocking] to
2727
* continue processing events when invoked.
28+
* @suppress JS Platform: **This is unstable API and it is subject to change.**
2829
*/
29-
public actual interface EventLoop {
30+
public interface EventLoop {
3031
/**
3132
* Processes next event in this event loop.
3233
*

0 commit comments

Comments
 (0)