public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: More while loops around wait() calls
@ 2007-11-28 17:03 moore
  0 siblings, 0 replies; only message in thread
From: moore @ 2007-11-28 17:03 UTC (permalink / raw)
  To: frysk-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-28 17:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28 17:03 [SCM] master: More while loops around wait() calls moore

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).