[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: javax.swing.Timer spurious Thread.sleep() interrupts f
From: |
Mark Wielaard |
Subject: |
[cp-patches] FYI: javax.swing.Timer spurious Thread.sleep() interrupts fixlet |
Date: |
Wed, 02 Nov 2005 22:30:27 +0100 |
Hi,
While debugging some other swing issue we found an small issue with
Timer.Waker ending prematurely if sleep() would be spuriously
interrupted. This makes sure the Waker only terminates when really
requested by Timer.stop().
2005-11-02 Mark Wielaard <address@hidden>
* javax/swing/Timer.java (Waker.run): Only break out when !running.
Committed,
Mark
Index: javax/swing/Timer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/Timer.java,v
retrieving revision 1.21
diff -u -r1.21 Timer.java
--- javax/swing/Timer.java 16 Sep 2005 18:44:56 -0000 1.21
+++ javax/swing/Timer.java 2 Nov 2005 21:29:46 -0000
@@ -68,7 +68,15 @@
running = true;
try
{
- sleep(initialDelay);
+ try
+ {
+ sleep(initialDelay);
+ }
+ catch (InterruptedException e)
+ {
+ if (!running)
+ return;
+ }
queueEvent();
@@ -81,7 +89,8 @@
}
catch (InterruptedException e)
{
- return;
+ if (!running)
+ break;
}
queueEvent();
@@ -93,7 +102,7 @@
}
running = false;
}
- catch (Exception e)
+ finally
{
// The timer is no longer running.
running = false;
signature.asc
Description: This is a digitally signed message part
- [cp-patches] FYI: javax.swing.Timer spurious Thread.sleep() interrupts fixlet,
Mark Wielaard <=