Oleh Ponomarenko
11/12/2019, 11:00 AMvar isStopped =false
do {
}while (isStopped.not())
karelpeeters
11/12/2019, 12:02 PMdo {
var stop= false
...
} while (!stop)
Oleh Ponomarenko
11/12/2019, 1:49 PMkarelpeeters
11/14/2019, 11:21 AMOleh Ponomarenko
11/14/2019, 11:22 AM@Volatile
var isStopped = false
And use the var in the coroutines:
CoroutineScope(Dispatchers.Default).launch {
do {
//do my stuff
} while (movie.isStopped.not())
}
Is it ok?karelpeeters
11/14/2019, 11:31 AM!
instead of .not()
though, I've never seen anyone use that.Oleh Ponomarenko
11/14/2019, 11:33 AM.not()
but not always. Really, I don't know what is the diffrence, maybe I need to find the dif ) to avoid unexpected issues.Oleh Ponomarenko
11/14/2019, 11:34 AM/**
* Returns the inverse of this boolean.
*/
karelpeeters
11/14/2019, 11:35 AMkarelpeeters
11/14/2019, 11:35 AMlistOf(true, false, true).map(Boolean::not) == listOf(false, true, false)
Oleh Ponomarenko
11/14/2019, 11:37 AMkarelpeeters
11/14/2019, 11:37 AMOleh Ponomarenko
11/14/2019, 11:39 AM!
.Oleh Ponomarenko
11/14/2019, 11:44 AM!
to .not()
though it's not the suggestion.
https://prntscr.com/pwulgikarelpeeters
11/14/2019, 11:45 AM