File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ This is the example from my [blog post with the same title](https://domnikl.gith
55- [ Step 0] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step0/src/main/kotlin/Main.kt )
66- [ Step 1] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step1/src/main/kotlin/Main.kt )
77- [ Step 2] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step2/src/main/kotlin/Main.kt )
8+ - [ Step 3] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step3/src/main/kotlin/Main.kt )
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ import kotlinx.coroutines.*
88import kotlinx.coroutines.javafx.JavaFx
99import kotlin.coroutines.CoroutineContext
1010
11- class MillisElapsedCounter (private val observer : Observer ) {
11+ class MillisElapsedCounter (private val observer : Observer ) : CoroutineScope {
12+ override val coroutineContext: CoroutineContext
13+ get() = Dispatchers .Default
14+
1215 fun start () {
13- GlobalScope . launch( Dispatchers . Default ) {
16+ launch {
1417 var millisElapsed = 0
1518
1619 while (true ) {
You can’t perform that action at this time.
0 commit comments