This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +1
-24
lines changed
samples/src/commonMain/kotlin/sample/coroutines Expand file tree Collapse file tree 2 files changed +1
-24
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ plugins {
2828
2929allprojects {
3030 group = " deezer.kustomexport"
31- version = " 0.2 .0"
31+ version = " 0.3 .0"
3232
3333 repositories {
3434 mavenLocal()
Original file line number Diff line number Diff line change 1818package sample.coroutines
1919
2020import deezer.kustomexport.KustomExport
21- import kotlinx.coroutines.CoroutineScope
2221import kotlinx.coroutines.Dispatchers
23- import kotlinx.coroutines.SupervisorJob
2422import kotlinx.coroutines.async
2523import kotlinx.coroutines.delay
26- import kotlinx.coroutines.job
27- import kotlinx.coroutines.launch
2824import kotlinx.coroutines.withContext
2925import kotlinx.coroutines.withTimeout
30- import kotlin.coroutines.coroutineContext
3126
3227@KustomExport
3328interface IComputer {
@@ -62,22 +57,4 @@ class ComputerTester(private val computer: IComputer) {
6257 }
6358 }
6459 }
65-
66- suspend fun startCancellable (): Cancellable {
67- val coroutineScope = CoroutineScope (Dispatchers .Unconfined + SupervisorJob ())
68- val job = coroutineScope.launch {
69- computer.longCompute()
70- }
71-
72- return object : Cancellable {
73- override fun cancel () {
74- job.cancel()
75- }
76- }
77- }
7860}
79-
80- @KustomExport
81- interface Cancellable {
82- fun cancel ()
83- }
You can’t perform that action at this time.
0 commit comments