From 41b120c0a6c72a77d576c473a7b84411069c6746 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 28 Aug 2020 21:35:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B9=A6=E7=B1=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/main/MainViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt index 098edef57..c9fc9066a 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt @@ -23,7 +23,7 @@ import java.util.concurrent.CopyOnWriteArraySet import java.util.concurrent.Executors class MainViewModel(application: Application) : BaseViewModel(application) { - val threadCount = AppConfig.threadCount + private var threadCount = AppConfig.threadCount private var upTocPool = Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher() val updateList = CopyOnWriteArraySet() private val bookMap = ConcurrentHashMap() @@ -37,8 +37,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { } fun upPool() { + threadCount = AppConfig.threadCount upTocPool.close() - upTocPool = Executors.newFixedThreadPool(AppConfig.threadCount).asCoroutineDispatcher() + upTocPool = Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher() } fun upAllBookToc() {