[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819
Michael 'Mickey' Lauer
mickey at vanille-media.de
Sat Aug 6 08:19:57 UTC 2011
The following commit has been merged in the debian branch:
commit 93673aa09cafc8fb5cfc3cb4055a73e25e595b70
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Tue May 11 00:40:37 2010 +0200
processguard: attempt to fix zombie at process shutdown
diff --git a/framework/patterns/processguard.py b/framework/patterns/processguard.py
index 7c04e90..019c59c 100644
--- a/framework/patterns/processguard.py
+++ b/framework/patterns/processguard.py
@@ -2,7 +2,7 @@
"""
freesmartphone.org Framework Daemon
-(C) 2008-2009 Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+(C) 2008-2010 Michael 'Mickey' Lauer <mlauer at vanille-media.de>
(C) 2008-2009 Openmoko, Inc.
GPLv2 or later
@@ -155,6 +155,16 @@ class ProcessGuard( object ):
os.kill( self.pid, sig )
except OSError:
logger.info( "shutdown: process already vanished" )
+ return
+
+ try:
+ os.waitpid( self.pid, os.WNOHANG )
+ except OSError:
+ logger.info( "shutdown: waitpid failed" )
+ return
+
+ # is GLib.process_close_pid bound?
+
else:
logger.info( "shutdown: process already vanished" )
@@ -174,14 +184,28 @@ if __name__ == "__main__":
def secondExit( pid, exitcode, exitsignal ):
print "second exit"
+ def thirdExit( pid, exitcode, exitsignal ):
+ print "third exit"
+ loop.quit()
+
+ def killit():
+ print "killing..."
+ p2.shutdown()
+ return False
+
loop = gobject.MainLoop()
p = ProcessGuard( "/bin/ls ." )
p.execute( onExit=firstExit )
+ p2 = ProcessGuard( "/bin/sleep 10" )
+ p2.execute( onExit=thirdExit )
+
+ gobject.timeout_add_seconds( 3, killit )
+
try:
loop.run()
except KeyboardInterrupt:
loop.quit()
else:
- print "oK"
+ print "OK"
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list