public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: moore@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM] master: More while loops around wait() calls
Date: Wed, 28 Nov 2007 17:03:00 -0000 [thread overview]
Message-ID: <20071128170304.3426.qmail@sourceware.org> (raw)
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
reply other threads:[~2007-11-28 17:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071128170304.3426.qmail@sourceware.org \
--to=moore@sourceware.org \
--cc=frysk-cvs@sourceware.org \
--cc=frysk@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).