view app/src/main/java/com/bartsent/simpleresizer/lib/ThreadPools.kt @ 34:19c584b29679

Add gradle files, bump rev to bypass installer cache misfeature.
author David Barts <n5jrn@me.com>
date Thu, 11 Mar 2021 17:31:56 -0800
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)
}