Use CoroutineStart.ATOMIC in some cases
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.core.ui.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.NonCancellable
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -13,7 +14,7 @@ fun interface ReversibleHandle {
|
||||
suspend fun reverse()
|
||||
}
|
||||
|
||||
fun ReversibleHandle.reverseAsync() = processLifecycleScope.launch(Dispatchers.Default) {
|
||||
fun ReversibleHandle.reverseAsync() = processLifecycleScope.launch(Dispatchers.Default, CoroutineStart.ATOMIC) {
|
||||
runCatchingCancellable {
|
||||
withContext(NonCancellable) {
|
||||
reverse()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.history.domain
|
||||
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.NonCancellable
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -30,7 +31,7 @@ class HistoryUpdateUseCase @Inject constructor(
|
||||
manga: Manga,
|
||||
readerState: ReaderState,
|
||||
percent: Float
|
||||
) = processLifecycleScope.launch(Dispatchers.Default) {
|
||||
) = processLifecycleScope.launch(Dispatchers.Default, CoroutineStart.ATOMIC) {
|
||||
runCatchingCancellable {
|
||||
withContext(NonCancellable) {
|
||||
invoke(manga, readerState, percent)
|
||||
|
||||
Reference in New Issue
Block a user