view app/src/main/java/com/bartsent/simpleresizer/lib/ThreadPools.kt @ 18:eedf995462d9 concur2

Parallalized, but ConstraintLayout started hosing the edit window.
author David Barts <n5jrn@me.com>
date Mon, 22 Feb 2021 07:04:31 -0800
parents
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)
}