Mercurial > cgi-bin > hgweb.cgi > SimpleResizer
annotate 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 |
rev | line source |
---|---|
18
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
1 package com.bartsent.simpleresizer.lib |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
2 |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
3 import java.util.concurrent.Executors |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
4 |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
5 /** |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
6 * Thread pools. We use just one, and it is sized to the maximum responsible thread use, |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
7 * which is one more than the number of cores. This is because when scaling, we have one |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
8 * worker thread sitting around and waiting for the remaining busy ones to finish. |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
9 */ |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
10 object ThreadPools { |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
11 val NWORKERS = Runtime.getRuntime().availableProcessors() + 1 |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
12 val WORKERS = Executors.newFixedThreadPool(NWORKERS) |
eedf995462d9
Parallalized, but ConstraintLayout started hosing the edit window.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
13 } |