[Android] AppScope: Add supervisor job
Geoffrey Métais
git at videolan.org
Mon Jan 7 10:18:26 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 7 10:08:10 2019 +0100| [79445a0ef44497c1a5db246a1c5f93b89df0cc34] | committer: Geoffrey Métais
AppScope: Add supervisor job
We don't want to cancel other actions if one fails
> https://code.videolan.org/videolan/vlc-android/commit/79445a0ef44497c1a5db246a1c5f93b89df0cc34
---
vlc-android/src/org/videolan/vlc/util/Workers.kt | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/util/Workers.kt b/vlc-android/src/org/videolan/vlc/util/Workers.kt
index 24f4501bd..1d3224d9e 100644
--- a/vlc-android/src/org/videolan/vlc/util/Workers.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Workers.kt
@@ -1,10 +1,7 @@
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
More information about the Android
mailing list