Fix typos

This commit is contained in:
Yanis Batura
2019-04-30 07:54:07 +07:00
committed by Roman Elizarov
parent 0ecf20bd62
commit a51b7fb8d0
8 changed files with 62 additions and 62 deletions
@@ -14,8 +14,8 @@ import kotlin.coroutines.experimental.*
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.1") @SinceKotlin("1.1")
@@ -28,8 +28,8 @@ public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.1") @SinceKotlin("1.1")
@@ -10,8 +10,8 @@ import kotlin.coroutines.experimental.Continuation
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.1") @SinceKotlin("1.1")
@@ -22,8 +22,8 @@ public expect inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.1") @SinceKotlin("1.1")
@@ -13,13 +13,13 @@ import kotlin.internal.InlineOnly
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -35,13 +35,13 @@ public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -66,7 +66,7 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine directly in the invoker's thread without going through the * Invocation of `resume(Unit)` starts coroutine directly in the invoker's thread without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
* *
* Repeated invocation of any resume function on the resulting continuation corrupts the * Repeated invocation of any resume function on the resulting continuation corrupts the
@@ -101,7 +101,7 @@ public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine directly in the invoker's thread without going through the * Invocation of `resume(Unit)` starts coroutine directly in the invoker's thread without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
* *
* Repeated invocation of any resume function on the resulting continuation corrupts the * Repeated invocation of any resume function on the resulting continuation corrupts the
@@ -11,13 +11,13 @@ import kotlin.internal.InlineOnly
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -29,13 +29,13 @@ public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -56,7 +56,7 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* Note that [completion] of this function may get invoked in an arbitrary context. * Note that [completion] of this function may get invoked in an arbitrary context.
* *
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
@@ -91,7 +91,7 @@ public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* Note that [completion] of this function may get invoked in an arbitrary context. * Note that [completion] of this function may get invoked in an arbitrary context.
* *
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
@@ -16,13 +16,13 @@ import kotlin.internal.InlineOnly
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -34,13 +34,13 @@ public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when coroutine completes with result or exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -63,7 +63,7 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* Note that [completion] of this function may get invoked in an arbitrary context. * Note that [completion] of this function may get invoked in an arbitrary context.
* *
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
@@ -97,7 +97,7 @@ public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
* This function returns unintercepted continuation. * This function returns unintercepted continuation.
* Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
* [ContinuationInterceptor] that might be present in the completion's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* Note that [completion] of this function may get invoked in an arbitrary context. * Note that [completion] of this function may get invoked in an arbitrary context.
* *
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
@@ -9,17 +9,17 @@ import kotlin.coroutines.intrinsics.*
import kotlin.internal.InlineOnly import kotlin.internal.InlineOnly
/** /**
* Interface representing a continuation after a suspension point that returns value of type `T`. * Interface representing a continuation after a suspension point that returns a value of type `T`.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
public interface Continuation<in T> { public interface Continuation<in T> {
/** /**
* Context of the coroutine that corresponds to this continuation. * The context of the coroutine that corresponds to this continuation.
*/ */
public val context: CoroutineContext public val context: CoroutineContext
/** /**
* Resumes the execution of the corresponding coroutine passing successful or failed [result] as the * Resumes the execution of the corresponding coroutine passing a successful or failed [result] as the
* return value of the last suspension point. * return value of the last suspension point.
*/ */
public fun resumeWith(result: Result<T>) public fun resumeWith(result: Result<T>)
@@ -28,7 +28,7 @@ public interface Continuation<in T> {
/** /**
* Classes and interfaces marked with this annotation are restricted when used as receivers for extension * Classes and interfaces marked with this annotation are restricted when used as receivers for extension
* `suspend` functions. These `suspend` extensions can only invoke other member or extension `suspend` functions on this particular * `suspend` functions. These `suspend` extensions can only invoke other member or extension `suspend` functions on this particular
* receiver only and are restricted from calling arbitrary suspension functions. * receiver and are restricted from calling arbitrary suspension functions.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
@@ -54,7 +54,7 @@ public inline fun <T> Continuation<T>.resumeWithException(exception: Throwable):
/** /**
* Creates [Continuation] instance with a given [context] and a given implementation of [resumeWith] method. * Creates a [Continuation] instance with the given [context] and implementation of [resumeWith] method.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@InlineOnly @InlineOnly
@@ -71,12 +71,12 @@ public inline fun <T> Continuation(
} }
/** /**
* Creates a coroutine without receiver and with result type [T]. * Creates a coroutine without a receiver and with result type [T].
* This function creates a new, fresh instance of suspendable computation every time it is invoked. * This function creates a new, fresh instance of suspendable computation every time it is invoked.
* *
* To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance. * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
* The [completion] continuation is invoked when coroutine completes with result or exception. * The [completion] continuation is invoked when the coroutine completes with a result or an exception.
* Repeated invocation of any resume function on the resulting continuation produces [IllegalStateException]. * Subsequent invocation of any resume function on the resulting continuation will produce an [IllegalStateException].
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
@@ -90,8 +90,8 @@ public fun <T> (suspend () -> T).createCoroutine(
* This function creates a new, fresh instance of suspendable computation every time it is invoked. * This function creates a new, fresh instance of suspendable computation every time it is invoked.
* *
* To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance. * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
* The [completion] continuation is invoked when coroutine completes with result or exception. * The [completion] continuation is invoked when the coroutine completes with a result or an exception.
* Repeated invocation of any resume function on the resulting continuation produces [IllegalStateException]. * Subsequent invocation of any resume function on the resulting continuation will produce an [IllegalStateException].
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
@@ -102,9 +102,9 @@ public fun <R, T> (suspend R.() -> T).createCoroutine(
SafeContinuation(createCoroutineUnintercepted(receiver, completion).intercepted(), COROUTINE_SUSPENDED) SafeContinuation(createCoroutineUnintercepted(receiver, completion).intercepted(), COROUTINE_SUSPENDED)
/** /**
* Starts coroutine without receiver and with result type [T]. * Starts a coroutine without a receiver and with result type [T].
* This function creates and start a new, fresh instance of suspendable computation every time it is invoked. * This function creates and starts a new, fresh instance of suspendable computation every time it is invoked.
* The [completion] continuation is invoked when coroutine completes with result or exception. * The [completion] continuation is invoked when the coroutine completes with a result or an exception.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
@@ -115,9 +115,9 @@ public fun <T> (suspend () -> T).startCoroutine(
} }
/** /**
* Starts coroutine with receiver type [R] and result type [T]. * Starts a coroutine with receiver type [R] and result type [T].
* This function creates and start a new, fresh instance of suspendable computation every time it is invoked. * This function creates and starts a new, fresh instance of suspendable computation every time it is invoked.
* The [completion] continuation is invoked when coroutine completes with result or exception. * The [completion] continuation is invoked when the coroutine completes with a result or an exception.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
@@ -130,11 +130,11 @@ public fun <R, T> (suspend R.() -> T).startCoroutine(
/** /**
* Obtains the current continuation instance inside suspend functions and suspends * Obtains the current continuation instance inside suspend functions and suspends
* currently running coroutine. * the currently running coroutine.
* *
* In this function both [Continuation.resume] and [Continuation.resumeWithException] can be used either synchronously in * In this function both [Continuation.resume] and [Continuation.resumeWithException] can be used either synchronously in
* the same stack-frame where suspension function is run or asynchronously later in the same thread or * the same stack-frame where the suspension function is run or asynchronously later in the same thread or
* from a different thread of execution. Repeated invocation of any resume function produces [IllegalStateException]. * from a different thread of execution. Subsequent invocation of any resume function will produce an [IllegalStateException].
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@InlineOnly @InlineOnly
@@ -146,7 +146,7 @@ public suspend inline fun <T> suspendCoroutine(crossinline block: (Continuation<
} }
/** /**
* Returns context of the current coroutine. * Returns the context of the current coroutine.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@Suppress("WRONG_MODIFIER_TARGET") @Suppress("WRONG_MODIFIER_TARGET")
@@ -10,15 +10,15 @@ import kotlin.coroutines.ContinuationInterceptor
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
/** /**
* Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. * Starts an unintercepted coroutine without a receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -27,15 +27,15 @@ public expect inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
): Any? ): Any?
/** /**
* Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. * Starts an unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
* *
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is invoker's responsibility to ensure that the proper invocation * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established. * context is established.
* *
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of suspended * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of a suspended
* coroutine using a reference to the suspending function. * coroutine using a reference to the suspending function.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@@ -60,7 +60,7 @@ public expect fun <R, T> (suspend R.() -> T).createCoroutineUnintercepted(
* *
* This function shall be used on the immediate result of [createCoroutineUnintercepted] or [suspendCoroutineUninterceptedOrReturn], * This function shall be used on the immediate result of [createCoroutineUnintercepted] or [suspendCoroutineUninterceptedOrReturn],
* in which case it checks for [ContinuationInterceptor] in the continuation's [context][Continuation.context], * in which case it checks for [ContinuationInterceptor] in the continuation's [context][Continuation.context],
* invokes [ContinuationInterceptor.interceptContinuation], caches and returns result. * invokes [ContinuationInterceptor.interceptContinuation], caches and returns the result.
* *
* If this function is invoked on other [Continuation] instances it returns `this` continuation unchanged. * If this function is invoked on other [Continuation] instances it returns `this` continuation unchanged.
*/ */
@@ -27,7 +27,7 @@ import kotlin.internal.InlineOnly
* *
* Invocation of [Continuation.resumeWith] resumes coroutine directly in the invoker's thread without going through the * Invocation of [Continuation.resumeWith] resumes coroutine directly in the invoker's thread without going through the
* [ContinuationInterceptor] that might be present in the coroutine's [CoroutineContext]. * [ContinuationInterceptor] that might be present in the coroutine's [CoroutineContext].
* It is invoker's responsibility to ensure that the proper invocation context is established. * It is the invoker's responsibility to ensure that a proper invocation context is established.
* [Continuation.intercepted] can be used to acquire the intercepted continuation. * [Continuation.intercepted] can be used to acquire the intercepted continuation.
* *
* Note that it is not recommended to call either [Continuation.resume] nor [Continuation.resumeWithException] functions synchronously * Note that it is not recommended to call either [Continuation.resume] nor [Continuation.resumeWithException] functions synchronously