[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./TODO doc/Gzz_Background.rst doc/Gzz_Memor...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz ./TODO doc/Gzz_Background.rst doc/Gzz_Memor... |
Date: |
Sat, 11 Jan 2003 06:37:58 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 03/01/11 06:37:57
Modified files:
. : TODO
doc : Gzz_Background.rst Gzz_Memory.rst
gzz/client : AbstractUpdateManager.java
gzz/util : Background.java
Log message:
twid
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.504&tr2=1.505&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/Gzz_Background.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/Gzz_Memory.rst.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/AbstractUpdateManager.java.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/Background.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.504 gzz/TODO:1.505
--- gzz/TODO:1.504 Fri Jan 10 15:23:36 2003
+++ gzz/TODO Sat Jan 11 06:37:57 2003
@@ -166,6 +166,10 @@
prototype of mindmap applitude (fall 2003?), check alternatives
- umltool paper dl 15.2., but should actually be done in the late Jan
- enhancing umltool
+ - important: add the explicit diagram references to the top edge
+ of the diagram!.
+ If nothing else then at LEAST the location where it's defined
ASAP.
+ The multi-ended link is otherwise working brilliantly.
- write all errors and warnings in some place so it's easy to
look for them and fix. Current output is incredibly bogously
spewy.
Index: gzz/doc/Gzz_Background.rst
diff -u gzz/doc/Gzz_Background.rst:1.1 gzz/doc/Gzz_Background.rst:1.2
--- gzz/doc/Gzz_Background.rst:1.1 Fri Jan 10 13:55:40 2003
+++ gzz/doc/Gzz_Background.rst Sat Jan 11 06:37:57 2003
@@ -18,7 +18,7 @@
jlinkpackage gzz.util
- class gzz.client.UpdateManager
+ class gzz.client.AbstractUpdateManager
jlink
methods
void doWhenIdle(Runnable r, int priority)
Index: gzz/doc/Gzz_Memory.rst
diff -u gzz/doc/Gzz_Memory.rst:1.10 gzz/doc/Gzz_Memory.rst:1.11
--- gzz/doc/Gzz_Memory.rst:1.10 Fri Jan 10 14:23:32 2003
+++ gzz/doc/Gzz_Memory.rst Sat Jan 11 06:37:57 2003
@@ -164,20 +164,28 @@
int getMaxBytes(float quality)
void setReservation(priority, bytes, quality, Obs o)
- dep "use" TextureImageMemoryConsumer gzz.util.Background
+ dep "addTask" TextureImageMemoryConsumer gzz.util.Background
+ dep "addTask" TextureImageMemoryConsumer gzz.client.AbstractUpdateManager
class gzz.util.Background
methods
void addTask(Runnable r, int priority)
assoc role(loader) multi(1) - multi(1) MemoryPartitioner
+ class gzz.client.AbstractUpdateManager
+ jlink
+ methods
+ void doWhenIdle(Runnable r, int priority)
---
- vertically(60, aaa, MemoryPartitioner, MemoryConsumer,
TextureImageMemoryConsumer);
pagequal.w = GLSpanner.e;
- horizontally(60, bbb, pagequal, TextureImageMemoryConsumer,
gzz.util.Background);
+ horizontally(60, bbb, pagequal, TextureImageMemoryConsumer);
+
+ horizontally(60, ccc, gzz.client.AbstractUpdateManager,
gzz.util.Background);
+
+ vertically(60, aaa, MemoryPartitioner, MemoryConsumer,
TextureImageMemoryConsumer, ccc);
gzz.mem.nw = MemoryPartitioner.nw + (-30, 30);
gzz.mem.se = MemoryConsumer.se + (30, -30);
Index: gzz/gzz/client/AbstractUpdateManager.java
diff -u gzz/gzz/client/AbstractUpdateManager.java:1.26
gzz/gzz/client/AbstractUpdateManager.java:1.27
--- gzz/gzz/client/AbstractUpdateManager.java:1.26 Fri Jan 10 13:44:51 2003
+++ gzz/gzz/client/AbstractUpdateManager.java Sat Jan 11 06:37:57 2003
@@ -41,7 +41,7 @@
*/
public abstract class AbstractUpdateManager implements Runnable {
-public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.26
2003/01/10 18:44:51 tjl Exp $";
+public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.27
2003/01/11 11:37:57 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -319,12 +319,34 @@
*/
protected abstract boolean handleEvents(boolean waitForEvent);
+ private PriorityQueue queue = new PriorityQueue();
+
+ /** Run a given task in the main thread at some point
+ * in the future.
+ * @see gzz.util.Background#addTask
+ */
+ public void doWhenIdle(Runnable r, int priority) {
+ synchronized(queue) {
+ queue.add(r, priority);
+ queue.notifyAll();
+ }
+ }
+
/** Do the background tasks that need to be done in
* the main thread.
* Implementations overriding this method should also delegate!
* @return true if something was done.
*/
protected boolean doIdle() {
+ synchronized(queue) {
+ Runnable r = (Runnable)queue.getAndRemoveLowest();
+ if(r != null) {
+ if(dbg) pa("Updmanager idle: run "+r);
+ r.run();
+ if(dbg) pa("Updmanager idle: finished run "+r);
+ return true;
+ }
+ }
return false;
}
Index: gzz/gzz/util/Background.java
diff -u gzz/gzz/util/Background.java:1.2 gzz/gzz/util/Background.java:1.3
--- gzz/gzz/util/Background.java:1.2 Fri Jan 10 14:53:17 2003
+++ gzz/gzz/util/Background.java Sat Jan 11 06:37:57 2003
@@ -34,14 +34,26 @@
/** Perform tasks in the background, in a queue.
* E.g. loading images.
+ * <p>
+ * If a task needs to be run again and again, it <b>can</b>
+ * add itself: while adding a task twice before it is run
+ * a single time will not cause it
+ * to run twice, a task adding itself while it is running
+ * will run again.
*/
public class Background {
public static boolean dbg = false;
final static void pa(String s) { System.out.println(s); }
- PriorityQueue queue = new PriorityQueue();
+ private PriorityQueue queue = new PriorityQueue();
+ /** Add a new task to be run in the background thread.
+ * If the task has already been added, and has not
+ * been started, the priority will be set to the lower number
+ * (higher priority) of the two, but the task will only
+ * be run once.
+ */
public void addTask(Runnable r, int priority) {
synchronized(queue) {
queue.add(r, priority);
@@ -49,11 +61,13 @@
}
}
+ /** Add a new task to run with priority 0.
+ */
public void addTask(Runnable r) {
addTask(r, 0);
}
- Thread bgThread = new Thread() {
+ private Thread bgThread = new Thread() {
public void run() {
try {
while(true) {
@@ -81,7 +95,7 @@
bgThread.setPriority(Thread.MIN_PRIORITY);
}
- static Background defaultInstance = null;
+ private static Background defaultInstance = null;
public static Background getDefaultInstance() {
if(defaultInstance == null)
defaultInstance = new Background();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./TODO doc/Gzz_Background.rst doc/Gzz_Memor...,
Tuomas J. Lukka <=