public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Eliminate second last use of observableProcRemovedXXX.
@ 2008-03-14 16:36 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-03-14 16:36 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  eb68a3add536b67c08e3bf5f33ee35437bd9a3b3 (commit)
      from  9661b5745777c3085edd270449c255a1466ebfb0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit eb68a3add536b67c08e3bf5f33ee35437bd9a3b3
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Mar 14 12:35:07 2008 -0400

    Eliminate second last use of observableProcRemovedXXX.
    
    frysk-core/frysk/ftrace/ChangeLog
    2008-03-14  Andrew Cagney  <cagney@redhat.com>
    
    	* Ftrace.java (ProcRemovedObserver): Re-implement as a Terminated
    	observer.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/ftrace/ChangeLog   |    5 ++++
 frysk-core/frysk/ftrace/Ftrace.java |   36 +++++++++++++++++-----------------
 2 files changed, 23 insertions(+), 18 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog
index 7f65642..cf76d7c 100644
--- a/frysk-core/frysk/ftrace/ChangeLog
+++ b/frysk-core/frysk/ftrace/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-14  Andrew Cagney  <cagney@redhat.com>
+
+	* Ftrace.java (ProcRemovedObserver): Re-implement as a Terminated
+	observer.
+
 2008-03-12  Andrew Cagney  <cagney@redhat.com>
 
 	* TestMappingGuard.java: Use StopEventLoopWhenProcTerminated.
diff --git a/frysk-core/frysk/ftrace/Ftrace.java b/frysk-core/frysk/ftrace/Ftrace.java
index 545ecb9..bb53b21 100644
--- a/frysk-core/frysk/ftrace/Ftrace.java
+++ b/frysk-core/frysk/ftrace/Ftrace.java
@@ -37,7 +37,6 @@
 // version and license this file solely under the GPL without
 // exception.
 
-
 package frysk.ftrace;
 
 import frysk.proc.Action;
@@ -53,11 +52,10 @@ import inua.util.PrintWriter;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
-import java.util.Observable;
-import java.util.Observer;
 import java.util.Set;
 import java.util.Iterator;
-import java.util.logging.*;
+import java.util.logging.Logger;
+import java.util.logging.Level;
 
 public class Ftrace
 {
@@ -265,7 +263,8 @@ public class Ftrace
 	    observationRequested(task);
 	}
 
-	Manager.host.observableProcRemovedXXX.addObserver(new ProcRemovedObserver(proc));
+	new ProcRemovedObserver(proc);
+
 	reporter.eventSingle(task, "attached " + proc.getExe());
 	++numProcesses;
     }
@@ -374,26 +373,27 @@ public class Ftrace
 
 
     /**
-     * An observer to stop the eventloop when the traced process exits.
+     * An observer to stop the eventloop when the traced process
+     * exits.
      */
     private class ProcRemovedObserver
-	implements Observer
+	implements TaskObserver.Terminated
     {
-	int pid;
-
 	ProcRemovedObserver (Proc proc) {
-	    this.pid = proc.getPid();
+	    proc.getMainTask().requestAddTerminatedObserver(this);
 	}
 
-	public void update (Observable o, Object object) {
-	    Proc proc = (Proc) object;
-	    if (proc.getPid() == this.pid) {
-		synchronized (Ftrace.this) {
-		    --numProcesses;
-		    if (numProcesses == 0)
-			Manager.eventLoop.requestStop();
-		}
+	public void addedTo (Object observable)	{}
+	public void addFailed (Object observable, Throwable arg1) {}
+	public void deletedFrom (Object observable) {}
+
+	public Action updateTerminated(Task task, Signal signal, int status) {
+	    synchronized (Ftrace.this) {
+		--numProcesses;
+		if (numProcesses == 0)
+		    Manager.eventLoop.requestStop();
 	    }
+	    return Action.CONTINUE;
 	}
     }
 


hooks/post-receive
--
frysk system monitor/debugger


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

only message in thread, other threads:[~2008-03-14 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 16:36 [SCM] master: Eliminate second last use of observableProcRemovedXXX cagney

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