Add to your list the ImageBlaster applet in the javadoc header for
java.awt.MediaTracker. The 'animator' Thread reference and the 'index' are
shared between threads. (Could this be at the root of the
buggy-animation-applet geneology tree?)
http://java.sun.com/products/jdk/1.2/docs/api/java/awt/MediaTracker.html
The use of 'index' is half-synchronized, by the way: synchronization is used
when setting but not when getting, leading to possible array-index-of-bounds
exceptions in the paint method. Here's the bug report I submitted last March
when I was on the rampage:
http://developer.java.sun.com/developer/bugParade/bugs/4216197.html
-- Joe BowbeerPS - I revise what I said about bad form: I think "sleep & interrupt" is just as good as "wait & notify" as a control mechanism for animation loops, independent of synch/visibility issues.
----- Original Message ----- From: Bill Pugh <pugh@cs.umd.edu> To: <javaMemoryModel@cs.umd.edu> Sent: Sunday, October 24, 1999 10:26 AM Subject: JavaMemoryModel: Code that sleeps and expects to see changes
> From Sun's demo programs included with jdk1.3 beta: > > Here is the code from demo/applet/Blink/Blink.java > > Thread blinker = null; // The thread that displays images > > public void run() { > Thread me = Thread.currentThread(); > while (blinker == me) { > try { > Thread.currentThread().sleep(delay); > } > catch (InterruptedException e) { > } > repaint(); > } > } > public void stop() { > blinker = null; > } >
------------------------------- JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:20 EDT