Skip to content

Commit b5d10d4

Browse files
committed
Make CoroutineStart.ATOMIC experimental as it covers important use-case with resource cleanup in finally block
Add missing @InternalCoroutinesApi Fixes #627
1 parent 938c5e9 commit b5d10d4

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ public fun CancellableContinuation<*>.removeOnCancel(node: LockFreeLinkedListNod
231231
* Removes a given node on cancellation.
232232
* @suppress **This is unstable API and it is subject to change.**
233233
*/
234+
@InternalCoroutinesApi
234235
public fun CancellableContinuation<*>.removeOnCancellation(node: LockFreeLinkedListNode) =
235236
invokeOnCancellation(handler = RemoveOnCancel(node).asHandler)
236237

common/kotlinx-coroutines-core-common/src/CompletedExceptionally.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import kotlin.coroutines.experimental.*
1717
* or artificial [CancellationException] if no cause was provided
1818
* @suppress **This is unstable API and it is subject to change.**
1919
*/
20-
// todo: rename to Cancelled
20+
@InternalCoroutinesApi
2121
open class CompletedExceptionally(
2222
@JvmField public val cause: Throwable
2323
) {
@@ -34,6 +34,7 @@ open class CompletedExceptionally(
3434
* if created on first access to [exception] property.
3535
* @suppress **This is unstable API and it is subject to change.**
3636
*/
37+
@InternalCoroutinesApi
3738
public class CancelledContinuation(
3839
continuation: Continuation<*>,
3940
cause: Throwable?

common/kotlinx-coroutines-core-common/src/CoroutineStart.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ public enum class CoroutineStart {
5454
*
5555
* Cancellability of coroutine at suspension points depends on the particular implementation details of
5656
* suspending functions as in [DEFAULT].
57-
*
58-
* @suppress **This an internal API and should not be used from general code.**
5957
*/
60-
@InternalCoroutinesApi
58+
@ExperimentalCoroutinesApi
6159
ATOMIC,
6260

6361
/**

common/kotlinx-coroutines-core-common/src/Dispatched.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ internal fun <T> Continuation<T>.resumeDirectWithException(exception: Throwable)
118118
/**
119119
* @suppress **This is unstable API and it is subject to change.**
120120
*/
121+
@InternalCoroutinesApi
121122
public interface DispatchedTask<in T> : Runnable {
122123
public val delegate: Continuation<T>
123124
public val resumeMode: Int get() = MODE_CANCELLABLE
@@ -158,6 +159,7 @@ public interface DispatchedTask<in T> : Runnable {
158159
/**
159160
* @suppress **This is unstable API and it is subject to change.**
160161
*/
162+
@InternalCoroutinesApi
161163
public fun <T> DispatchedTask<T>.dispatch(mode: Int = MODE_CANCELLABLE) {
162164
var useMode = mode
163165
val delegate = this.delegate

common/kotlinx-coroutines-core-common/src/Job.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ public inline fun DisposableHandle(crossinline block: () -> Unit) =
411411
*
412412
* @suppress **This is unstable API and it is subject to change.**
413413
*/
414+
@InternalCoroutinesApi
414415
internal interface ChildJob : Job {
415416
/**
416417
* Parent is cancelling its child by invoking this method.
@@ -419,6 +420,7 @@ internal interface ChildJob : Job {
419420
*
420421
* @suppress **This is unstable API and it is subject to change.**
421422
*/
423+
@InternalCoroutinesApi
422424
public fun parentCancelled(parentJob: Job)
423425
}
424426

@@ -427,6 +429,7 @@ internal interface ChildJob : Job {
427429
*
428430
* @suppress **This is unstable API and it is subject to change.**
429431
*/
432+
@InternalCoroutinesApi
430433
internal interface ChildHandle : DisposableHandle {
431434
/**
432435
* Child is cancelling its parent by invoking this method.
@@ -436,6 +439,7 @@ internal interface ChildHandle : DisposableHandle {
436439
*
437440
* @suppress **This is unstable API and it is subject to change.**
438441
*/
442+
@InternalCoroutinesApi
439443
public fun childCancelled(cause: Throwable): Boolean
440444
}
441445

0 commit comments

Comments
 (0)