aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2004-10-13 23:14:00 +0000
committerKevin Rushforth <[email protected]>2004-10-13 23:14:00 +0000
commitcdf24368541b18e5ffc56f5c9449310e874f4a2f (patch)
treeac0d3b904f2aa4b18fa4b52070069a0de3237c93
parent09849d2681919b872a7ccccd7e927f41f47b10ff (diff)
Issue number: 11
Submitted by: kcr Fixed Issue 11: Seemingly inconsistent delays in updating attributes git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@55 ba19aa83-45c5-6ac9-afd3-db810772062c
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java49
1 files changed, 14 insertions, 35 deletions
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index d846f96..4818bd8 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -1541,10 +1541,9 @@ class MasterControl {
View v;
J3dThreadData lastRunThread = null;
waitTimestamp++;
- sleepTime = Long.MAX_VALUE;
+ sleepTime = 0L;
- boolean threadToRun = false;
- boolean needToSetWork = false;
+ boolean threadToRun = false; // Not currently used
// Fix for Issue 12: loop through the list of threads, calling
// computeCycleTime() exactly once per view. This ensures that
@@ -1555,7 +1554,9 @@ class MasterControl {
thread = threads[i];
if (thread.view != v) {
thread.view.computeCycleTime();
- if (thread.view.sleepTime < sleepTime) {
+ // Set sleepTime to the value needed to satify the
+ // minimum cycle time of the slowest view
+ if (thread.view.sleepTime > sleepTime) {
sleepTime = thread.view.sleepTime;
}
}
@@ -1571,12 +1572,6 @@ class MasterControl {
if ((thread.lastUpdateTime > thread.lastRunTime) &&
!thread.thread.userStop) {
- if (!thread.view.isMinCycleTimeAchieve) {
- thread.needsRun = false;
- needToSetWork = true;
- continue;
- }
-
if (thread.thread.lastWaitTimestamp == waitTimestamp) {
// This renderer thread is repeated. We must wait
// until all previous renderer threads done before
@@ -1650,32 +1645,16 @@ class MasterControl {
}
- if (needToSetWork && !threadToRun) {
- // Modified the following in the course of fixing Issue 12:
- //
- // 1. don't modify sleepTime by subtracting a value that
- // doesn't even represent time!
- //
- // 2. use sleep(sleepTime) rather than wait(sleepTime)
- //
- // Note that this will need to be redone anyway for Issue 11
-
- // BUG: sleepTime -= (currentTime - lastTime);
-
- if (sleepTime > 0) {
- // OLD: runMonitor(SLEEP, null, null, null, null);
-
- // System.err.println("MasterControl: sleep(" + sleepTime + ")");
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- System.err.println(e);
- }
- // System.err.println("MasterControl: done sleeping");
+ // Sleep for the amount of time needed to satisfy the minimum
+ // cycle time for all views.
+ if (sleepTime > 0) {
+ // System.err.println("MasterControl: sleep(" + sleepTime + ")");
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+ System.err.println(e);
}
- // Need to invoke MC to do work
- // next time after sleep
- setWork();
+ // System.err.println("MasterControl: done sleeping");
}
}