view app/src/main/java/com/bartsent/simpleresizer/lib/ThreadPools.kt @ 46:8205f3c17500 default tip

Tweak messages a little.
author David Barts <n5jrn@me.com>
date Wed, 14 Apr 2021 08:18:23 -0700
parents eedf995462d9
children
line wrap: on
line source

package com.bartsent.simpleresizer.lib

import java.util.concurrent.Executors

/**
 * Thread pools. We use just one, and it is sized to the maximum responsible thread use,
 * which is one more than the number of cores. This is because when scaling, we have one
 * worker thread sitting around and waiting for the remaining busy ones to finish.
 */
object ThreadPools {
    val NWORKERS = Runtime.getRuntime().availableProcessors() + 1
    val WORKERS = Executors.newFixedThreadPool(NWORKERS)
}