spand
07/04/2018, 5:31 AMcounter
variable ? ie. that the latest write to counter
is always read by the next processing thread?
fun counterActor() = actor<CounterMsg> {
var counter = 0 // actor state
for (msg in channel) { // iterate over incoming messages
when (msg) {
is IncCounter -> counter++
is GetCounter -> msg.response.complete(counter)
}
}
}
spand
07/04/2018, 5:32 AMlouiscad
07/04/2018, 6:02 AMspand
07/04/2018, 6:05 AMEvgeniy Zaharov
07/04/2018, 7:54 AMspand
07/04/2018, 8:03 AM