aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/DefaultEDTUtil.java11
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java14
2 files changed, 21 insertions, 4 deletions
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index 0bcd3323c..fd757fba6 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -55,6 +55,7 @@ public class DefaultEDTUtil implements EDTUtil {
private String name;
int start_iter=0;
private Runnable dispatchMessages;
+ private static long pollPeriod = EDTUtil.defaultEDTPollPeriod;
public DefaultEDTUtil(ThreadGroup tg, String name, Runnable dispatchMessages) {
this.threadGroup = tg;
@@ -64,6 +65,14 @@ public class DefaultEDTUtil implements EDTUtil {
this.edt.setDaemon(true); // don't stop JVM from shutdown ..
}
+ final public long getPollPeriod() {
+ return pollPeriod;
+ }
+
+ final public void setPollPeriod(long ms) {
+ pollPeriod = ms;
+ }
+
public final void reset() {
synchronized(edtLock) {
waitUntilStopped();
@@ -271,7 +280,7 @@ public class DefaultEDTUtil implements EDTUtil {
// wait for tasks
if(!shouldStop && tasks.size()==0) {
try {
- tasks.wait(defaultEDTPollGranularity);
+ tasks.wait(pollPeriod);
} catch (InterruptedException e) {
e.printStackTrace();
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index cca1e321c..6d0b102c7 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -29,7 +29,6 @@
package jogamp.newt.driver.awt;
import java.awt.EventQueue;
-import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -49,7 +48,8 @@ public class AWTEDTUtil implements EDTUtil {
private static TimerTask pumpMessagesTimerTask=null;
private static final Map<Display, Runnable> pumpMessageDisplayMap = new HashMap<Display, Runnable>();
private static AWTEDTUtil singletonMainThread = new AWTEDTUtil(); // one singleton MainThread
-
+ private static long pollPeriod = EDTUtil.defaultEDTPollPeriod;
+
public static AWTEDTUtil getSingleton() {
return singletonMainThread;
}
@@ -58,6 +58,14 @@ public class AWTEDTUtil implements EDTUtil {
// package private access ..
}
+ final public long getPollPeriod() {
+ return pollPeriod;
+ }
+
+ final public void setPollPeriod(long ms) {
+ pollPeriod = ms;
+ }
+
final public void reset() {
// nop AWT is always running
}
@@ -132,7 +140,7 @@ public class AWTEDTUtil implements EDTUtil {
}
}
};
- pumpMessagesTimer.scheduleAtFixedRate(pumpMessagesTimerTask, 0, defaultEDTPollGranularity);
+ pumpMessagesTimer.scheduleAtFixedRate(pumpMessagesTimerTask, 0, pollPeriod);
}
pumpMessageDisplayMap.put(dpy, pumpMessage);
}