This is the mail archive of the
frysk-cvs@sources.redhat.com
mailing list for the frysk project.
[SCM] master: More while loops around wait() calls
- From: moore at sourceware dot org
- To: frysk-cvs at sourceware dot org
- Date: 28 Nov 2007 17:03:04 -0000
- Subject: [SCM] master: More while loops around wait() calls
- Reply-to: frysk at sourceware dot org
The branch, master has been updated
via 06c524cb3ec657e014e7aa1d796a9f5945fc3093 (commit)
from 0d030927ffff2842d7175af81a37b725c7842fc4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 06c524cb3ec657e014e7aa1d796a9f5945fc3093
Author: Tim Moore <moore@blackbox.bricoworks.com>
Date: Wed Nov 28 17:58:21 2007 +0100
More while loops around wait() calls
frysk-core/frysk/event/ChangeLog
2007-11-28 Tim Moore <timoore@redhat.com>
* EventLoop.java (run, start, running) Loop around the wait,
testing the state of the running object.
frysk-core/frysk/util/ChangeLog
2007-11-28 Tim Moore <timoore@redhat.com>
* TestCountDownLatch.java (testTimeout): wrap time out await in
while loop.
-----------------------------------------------------------------------
Summary of changes:
frysk-core/frysk/event/ChangeLog | 5 +++++
frysk-core/frysk/event/EventLoop.java | 20 +++++++++++++-------
frysk-core/frysk/util/ChangeLog | 5 +++++
frysk-core/frysk/util/TestCountDownLatch.java | 12 ++++++++++--
4 files changed, 33 insertions(+), 9 deletions(-)
First 500 lines of diff:
diff --git a/frysk-core/frysk/event/ChangeLog b/frysk-core/frysk/event/ChangeLog
index 9cfcd38..4eb7b01 100644
--- a/frysk-core/frysk/event/ChangeLog
+++ b/frysk-core/frysk/event/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-28 Tim Moore <timoore@redhat.com>
+
+ * EventLoop.java (run, start, running) Loop around the wait,
+ testing the state of the running object.
+
2007-11-27 Tim Moore <timoore@redhat.com>
* Request.java (Handler.execute, Handler.request): Wait inside a
diff --git a/frysk-core/frysk/event/EventLoop.java b/frysk-core/frysk/event/EventLoop.java
index 365f2d9..bf62450 100644
--- a/frysk-core/frysk/event/EventLoop.java
+++ b/frysk-core/frysk/event/EventLoop.java
@@ -473,6 +473,10 @@ public abstract class EventLoop
* existing pending events are always processed before performing
* the first poll.
*/
+ private class Running {
+ boolean isRunning = false;
+ }
+
public final void run ()
{
logger.log (Level.FINE, "{0} run\n", this);
@@ -480,6 +484,7 @@ public abstract class EventLoop
// running.
synchronized (running) {
updateTid();
+ running.isRunning = true;
running.notify();
}
runEventLoop (false);
@@ -495,15 +500,16 @@ public abstract class EventLoop
setDaemon(true);
super.start();
// Make certain that the server really is running.
- try {
- running.wait();
- }
- catch (InterruptedException ie) {
- throw new RuntimeException (ie);
- }
+ while (!running.isRunning) {
+ try {
+ running.wait();
+ }
+ catch (InterruptedException ie) {
+ }
+ }
}
}
- private Object running = new Object();
+ private Running running = new Running();
/**
diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog
index 24e3eb0..d8feb8e 100644
--- a/frysk-core/frysk/util/ChangeLog
+++ b/frysk-core/frysk/util/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-28 Tim Moore <timoore@redhat.com>
+
+ * TestCountDownLatch.java (testTimeout): wrap time out await in
+ while loop.
+
2007-11-28 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com>
* PPC64LinuxElfCorefile.java: Fixed the floating pointer
diff --git a/frysk-core/frysk/util/TestCountDownLatch.java b/frysk-core/frysk/util/TestCountDownLatch.java
index 61b687a..3535d02 100644
--- a/frysk-core/frysk/util/TestCountDownLatch.java
+++ b/frysk-core/frysk/util/TestCountDownLatch.java
@@ -77,6 +77,14 @@ public class TestCountDownLatch
Thread thread2 = new CountDownThread();
thread1.start();
thread2.start();
- assertEquals("timeout", latch.await(1000), false);
+ boolean timedOut = false;
+ while (true) {
+ try {
+ timedOut = latch.await(1000);
+ break;
+ } catch (InterruptedException e) {
+ }
+ }
+ assertEquals("timeout", timedOut, false);
}
-}
\ No newline at end of file
+}
hooks/post-receive
--
frysk system monitor/debugger