All Downloads are FREE. Search and download functionalities are using the official Maven repository.

intrinsics.Cancellable.kt Maven / Gradle / Ivy

There is a newer version: 1.3.8
Show newest version
/*
 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.coroutines.intrinsics

import kotlinx.coroutines.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*

/**
 * Use this function to start coroutine in a cancellable way, so that it can be cancelled
 * while waiting to be dispatched.
 */
public fun  (suspend () -> T).startCoroutineCancellable(completion: Continuation) =
    createCoroutineUnintercepted(completion).intercepted().resumeCancellable(Unit)

/**
 * Use this function to start coroutine in a cancellable way, so that it can be cancelled
 * while waiting to be dispatched.
 */
public fun  (suspend (R) -> T).startCoroutineCancellable(receiver: R, completion: Continuation) =
    createCoroutineUnintercepted(receiver, completion).intercepted().resumeCancellable(Unit)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy