Skip to content
Snippets Groups Projects
Commit 79445a0e authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

AppScope: Add supervisor job

We don't want to cancel other actions if one fails
parent 3a58f53d
No related branches found
No related tags found
No related merge requests found
package org.videolan.vlc.util
import android.os.Looper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.launch
import kotlinx.coroutines.*
fun runBackground(runnable: Runnable) {
if (Looper.myLooper() != Looper.getMainLooper()) runnable.run()
......@@ -20,5 +17,5 @@ fun runIO(runnable: Runnable) {
}
object AppScope : CoroutineScope {
override val coroutineContext = Dispatchers.Main.immediate
override val coroutineContext = Dispatchers.Main.immediate + SupervisorJob()
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment