File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/main/kotlin/com/lambda/threading Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import com.lambda.context.SafeContext
2323import com.lambda.event.EventFlow
2424import com.mojang.blaze3d.systems.RenderSystem.isOnRenderThread
2525import kotlinx.coroutines.CoroutineDispatcher
26+ import kotlinx.coroutines.CoroutineScope
2627import kotlinx.coroutines.Dispatchers
2728import kotlinx.coroutines.future.await
2829import kotlinx.coroutines.launch
@@ -52,17 +53,17 @@ inline fun <T> runSafe(block: SafeContext.() -> T) =
5253 *
5354 * @param block The block of code to be executed concurrently.
5455 */
55- inline fun runConcurrent (scheduler : CoroutineDispatcher = Dispatchers .Default , crossinline block : suspend () -> Unit ) =
56+ inline fun runConcurrent (scheduler : CoroutineDispatcher = Dispatchers .Default , crossinline block : suspend CoroutineScope . () -> Unit ) =
5657 EventFlow .lambdaScope.launch(scheduler) {
5758 block()
5859 }
5960
60- inline fun runIO (crossinline block : suspend () -> Unit ) =
61+ inline fun runIO (crossinline block : suspend CoroutineScope . () -> Unit ) =
6162 runConcurrent(Dispatchers .IO ) {
6263 block()
6364 }
6465
65- inline fun taskContext (crossinline block : suspend () -> Unit ) =
66+ inline fun taskContext (crossinline block : suspend CoroutineScope . () -> Unit ) =
6667 EventFlow .lambdaScope.launch {
6768 block()
6869 }
You can’t perform that action at this time.
0 commit comments