back to octagonal lightspreading and one more failed test

This commit is contained in:
minjaesong
2020-02-28 05:39:46 +09:00
parent c4521b9fd9
commit bac2190104
3 changed files with 49 additions and 64 deletions

View File

@@ -12,14 +12,14 @@ typealias ThreadableFun = (Int) -> Unit
object ThreadExecutor {
val threadCount = Runtime.getRuntime().availableProcessors() // not using (logicalCores + 1) method; it's often better idea to reserve one extra thread for other jobs in the app
private var executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())
private var executor = Executors.newFixedThreadPool(threadCount)
private fun checkShutdown() {
if (!executor.isShutdown) return
if (executor.isShutdown&& !executor.isTerminated)
throw IllegalStateException("Pool is closed, come back when all the threads are terminated.")
executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())
executor = Executors.newFixedThreadPool(threadCount)
}
fun submit(t: Runnable): Future<*> {