From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3471 invoked by alias); 28 Nov 2007 17:03:04 -0000 Received: (qmail 3445 invoked by uid 9639); 28 Nov 2007 17:03:04 -0000 Date: Wed, 28 Nov 2007 17:03:00 -0000 Message-ID: <20071128170304.3426.qmail@sourceware.org> From: moore@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: More while loops around wait() calls X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 0d030927ffff2842d7175af81a37b725c7842fc4 X-Git-Newrev: 06c524cb3ec657e014e7aa1d796a9f5945fc3093 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2007-q4/txt/msg00482.txt.bz2 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 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 * 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 * 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 + + * EventLoop.java (run, start, running) Loop around the wait, + testing the state of the running object. + 2007-11-27 Tim Moore * 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 + + * TestCountDownLatch.java (testTimeout): wrap time out await in + while loop. + 2007-11-28 Jose Flavio Aguilar Paulino * 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