File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
libraries/stdlib/src/kotlin/coroutines/experimental Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,12 @@ public fun <T> (suspend () -> T).startCoroutine(
49
49
}
50
50
51
51
/* *
52
- * Creates coroutine with receiver type [R] and result type [T].
52
+ * Creates a coroutine with receiver type [R] and result type [T].
53
53
* This function creates a new, fresh instance of suspendable computation every time it is invoked.
54
+ *
54
55
* To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
55
56
* The [completion] continuation is invoked when coroutine completes with result or exception.
57
+ * Repeated invocation of any resume function on the resulting continuation produces [IllegalStateException].
56
58
*/
57
59
@SinceKotlin(" 1.1" )
58
60
@Suppress(" UNCHECKED_CAST" )
@@ -62,10 +64,12 @@ public fun <R, T> (suspend R.() -> T).createCoroutine(
62
64
): Continuation <Unit > = SafeContinuation (createCoroutineUnchecked(receiver, completion), COROUTINE_SUSPENDED )
63
65
64
66
/* *
65
- * Creates coroutine without receiver and with result type [T].
67
+ * Creates a coroutine without receiver and with result type [T].
66
68
* This function creates a new, fresh instance of suspendable computation every time it is invoked.
69
+ *
67
70
* To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
68
71
* The [completion] continuation is invoked when coroutine completes with result or exception.
72
+ * Repeated invocation of any resume function on the resulting continuation produces [IllegalStateException].
69
73
*/
70
74
@SinceKotlin(" 1.1" )
71
75
@Suppress(" UNCHECKED_CAST" )
Original file line number Diff line number Diff line change @@ -52,6 +52,16 @@ public val COROUTINE_SUSPENDED: Any = Any()
52
52
53
53
// JVM declarations
54
54
55
+ /* *
56
+ * Creates a coroutine without receiver and with result type [T].
57
+ * This function creates a new, fresh instance of suspendable computation every time it is invoked.
58
+ *
59
+ * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
60
+ * The [completion] continuation is invoked when coroutine completes with result or exception.
61
+ *
62
+ * This function is _unchecked_. Repeated invocation of any resume function on the resulting continuation corrupts the
63
+ * state machine of the coroutine and may result in arbitrary behaviour or exception.
64
+ */
55
65
@SinceKotlin(" 1.1" )
56
66
@kotlin.jvm.JvmVersion
57
67
public fun <T > (suspend () -> T ).createCoroutineUnchecked(
@@ -64,6 +74,16 @@ public fun <T> (suspend () -> T).createCoroutineUnchecked(
64
74
else
65
75
(this .create(completion) as kotlin.coroutines.experimental.jvm.internal.CoroutineImpl ).facade
66
76
77
+ /* *
78
+ * Creates a coroutine with receiver type [R] and result type [T].
79
+ * This function creates a new, fresh instance of suspendable computation every time it is invoked.
80
+ *
81
+ * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
82
+ * The [completion] continuation is invoked when coroutine completes with result or exception.
83
+ *
84
+ * This function is _unchecked_. Repeated invocation of any resume function on the resulting continuation corrupts the
85
+ * state machine of the coroutine and may result in arbitrary behaviour or exception.
86
+ */
67
87
@SinceKotlin(" 1.1" )
68
88
@kotlin.jvm.JvmVersion
69
89
public fun <R , T > (suspend R .() -> T ).createCoroutineUnchecked(
You can’t perform that action at this time.
0 commit comments