aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-21 18:34:10 +0200
committerSven Gothel <[email protected]>2023-09-21 18:34:10 +0200
commit7fe177c87184cbe9c170ed708a1db3deeb7e390c (patch)
tree81bc7e15e141d4b581f1ff51955b892616c51fde /src/java/com
parent2b754aafac129493976fcd82d0dacf145d44cab1 (diff)
WorkerThread: Remove minDelayMS field, have it in Runnable branch only
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/jogamp/common/util/WorkerThread.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/java/com/jogamp/common/util/WorkerThread.java b/src/java/com/jogamp/common/util/WorkerThread.java
index 5beb9d9..52182b6 100644
--- a/src/java/com/jogamp/common/util/WorkerThread.java
+++ b/src/java/com/jogamp/common/util/WorkerThread.java
@@ -53,7 +53,6 @@ public class WorkerThread {
private volatile boolean shallStop = false;
private final Duration minPeriod;
private final Duration minDelay;
- private final long minDelayMS;
private final boolean useMinimum;
private final Callback cbWork;
private final Runnable cbInitLocked;
@@ -85,8 +84,7 @@ public class WorkerThread {
public WorkerThread(final Duration minPeriod, final Duration minDelay, final boolean daemonThread, final Callback work, final Runnable init, final Runnable end) {
this.minPeriod = null != minPeriod ? minPeriod : Duration.ZERO;
this.minDelay = null != minDelay ? minDelay : Duration.ZERO;
- this.minDelayMS = this.minDelay.toMillis();
- this.useMinimum = this.minPeriod.toMillis() > 0 || this.minDelayMS > 0;
+ this.useMinimum = this.minPeriod.toMillis() > 0 || this.minDelay.toMillis() > 0;
this.cbWork = work;
this.cbInitLocked = init;
this.cbEndLocked = end;
@@ -279,6 +277,7 @@ public class WorkerThread {
}
isBlocked = false;
if( useMinimum ) {
+ final long minDelayMS = minDelay.toMillis();
final Instant t1 = Instant.now();
final Duration td = Duration.between(t0, t1);
if( minPeriod.compareTo(td) > 0 ) {