class CoroutineScope
source · line 40public
public class CoroutineScope internal constructor(
/**
* The parent used for children launched through this scope.
*/
public val job: Job,
private val executor: CoroutineExecutor?
)
Launches child computations associated with one parent job and a default executor.
function launch
source · line 72public
public fun launch(block: suspend CoroutineScope.() -> Unit): Job
Starts a child returning Unit and returns its job for cancellation or joining.
parameter block
source · line 72public
block: suspend CoroutineScope.() -> Unit
function async
source · line 81public
public fun <T> async(block: suspend CoroutineScope.() -> T): Deferred<T>
Starts a child that produces a result and returns a deferred handle.
parameter block
source · line 81public
block: suspend CoroutineScope.() -> T
type parameter T
source · line 81public
T
function launch
source · line 75public
public fun launch(executor: CoroutineExecutor, block: suspend CoroutineScope.() -> Unit): Job
Starts a child on the selected executor while retaining this scope's job parent.
parameter block
source · line 75public
block: suspend CoroutineScope.() -> Unit
parameter executor
source · line 75public
executor: CoroutineExecutor
function async
source · line 92public
public fun <T> async(executor: CoroutineExecutor, block: suspend CoroutineScope.() -> T): Deferred<T>
Starts a child returning a result on the selected executor.
parameter block
source · line 94public
block: suspend CoroutineScope.() -> T
type parameter T
source · line 92public
T
parameter executor
source · line 93public
executor: CoroutineExecutor
property job
source · line 44public
public val job: Job
get: public read-only
The parent used for children launched through this scope.