Skip to content

Commit

Permalink
step3
Browse files Browse the repository at this point in the history
  • Loading branch information
domnikl committed Feb 2, 2019
1 parent 76e1d8f commit 227e189
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ This is the example from my [blog post with the same title](https://domnikl.gith
- [Step 0](https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step0/src/main/kotlin/Main.kt)
- [Step 1](https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step1/src/main/kotlin/Main.kt)
- [Step 2](https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step2/src/main/kotlin/Main.kt)
- [Step 3](https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step3/src/main/kotlin/Main.kt)
7 changes: 5 additions & 2 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import kotlinx.coroutines.*
import kotlinx.coroutines.javafx.JavaFx
import kotlin.coroutines.CoroutineContext

class MillisElapsedCounter(private val observer: Observer) {
class MillisElapsedCounter(private val observer: Observer) : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = Dispatchers.Default

fun start() {
GlobalScope.launch(Dispatchers.Default) {
launch {
var millisElapsed = 0

while (true) {
Expand Down

0 comments on commit 227e189

Please sign in to comment.