Use initializer instead of getter for coroutineContext

This commit is contained in:
FooIbar authored and tarsin committed 2023-02-20 08:50:26 +08:00
1 parent 5d64e8c61b
commit 473ff4d308
1 file changed
+2 -4
@@ -59,9 +59,10 @@ import moe.tarsin.coroutines.runSuspendCatching
import okhttp3.executeAsync
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicInteger
import kotlin.coroutines.CoroutineContext
class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineScope {
override val coroutineContext = Dispatchers.IO + Job()
@Volatile
lateinit var mPageStateArray: IntArray
lateinit var mSpiderInfo: SpiderInfo
@@ -525,9 +526,6 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
}
}
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + Job()
private val mWorkerScope = object {
private val mFetcherJobMap = hashMapOf<Int, Job>()
private val mSemaphore = Semaphore(Settings.getMultiThreadDownload())