IODispatcherExecutor -> DispatcherExecutor

This commit is contained in:
topjohnwu 2021-12-13 04:05:36 -08:00
parent 54e3f1998a
commit b4120cddfb
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import android.content.Context
import android.content.res.Configuration import android.content.res.Configuration
import android.os.Bundle import android.os.Bundle
import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.DynAPK
import com.topjohnwu.magisk.core.utils.IODispatcherExecutor import com.topjohnwu.magisk.core.utils.DispatcherExecutor
import com.topjohnwu.magisk.core.utils.RootRegistry import com.topjohnwu.magisk.core.utils.RootRegistry
import com.topjohnwu.magisk.core.utils.ShellInit import com.topjohnwu.magisk.core.utils.ShellInit
import com.topjohnwu.magisk.core.utils.updateConfig import com.topjohnwu.magisk.core.utils.updateConfig
@ -16,6 +16,7 @@ import com.topjohnwu.magisk.ktx.unwrap
import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.internal.UiThreadHandler import com.topjohnwu.superuser.internal.UiThreadHandler
import com.topjohnwu.superuser.ipc.RootService import com.topjohnwu.superuser.ipc.RootService
import kotlinx.coroutines.Dispatchers
import timber.log.Timber import timber.log.Timber
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -44,7 +45,7 @@ open class App() : Application() {
.setFlags(Shell.FLAG_MOUNT_MASTER) .setFlags(Shell.FLAG_MOUNT_MASTER)
.setInitializers(ShellInit::class.java) .setInitializers(ShellInit::class.java)
.setTimeout(2)) .setTimeout(2))
Shell.EXECUTOR = IODispatcherExecutor() Shell.EXECUTOR = DispatcherExecutor(Dispatchers.IO)
// Some context magic // Some context magic
val app: Application val app: Application

View File

@ -5,10 +5,10 @@ import java.util.concurrent.AbstractExecutorService
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class IODispatcherExecutor : AbstractExecutorService() { class DispatcherExecutor(dispatcher: CoroutineDispatcher) : AbstractExecutorService() {
private val job = SupervisorJob() private val job = SupervisorJob()
private val scope = CoroutineScope(job + Dispatchers.IO) private val scope = CoroutineScope(job + dispatcher)
private val latch = CountDownLatch(1) private val latch = CountDownLatch(1)
init { init {