[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82

Michael 'Mickey' Lauer mickey at vanille-media.de
Mon Feb 2 18:51:30 UTC 2009


The following commit has been merged in the master branch:
commit 0fd56bffb7e7811b2be32a27b9bfb1d767446f5c
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date:   Thu Dec 4 16:18:57 2008 +0100

    give subsystems and objects a chance to properly shut down

diff --git a/framework/controller.py b/framework/controller.py
index d397bb8..7a13842 100644
--- a/framework/controller.py
+++ b/framework/controller.py
@@ -151,8 +151,9 @@ class Controller( daemon.Daemon ):
         """
         Quit the mainloop.
         """
-        # FIXME notify all subsystems to clean up their resources
         logger.info( "shutting down..." )
+        for subsystem in self._subsystems.values():
+            subsystem.shutdown()
         self.mainloop.quit()
 
     #
diff --git a/framework/objectquery.py b/framework/objectquery.py
index 1e3d230..6dbb992 100644
--- a/framework/objectquery.py
+++ b/framework/objectquery.py
@@ -16,6 +16,7 @@ from .introspection import process_introspection_data
 from .config import DBUS_INTERFACE_PREFIX
 from framework.patterns import tasklet
 
+import gobject
 import dbus, dbus.service
 
 import os, sys, logging, logging.handlers
@@ -65,6 +66,10 @@ class Framework( dbus.service.Object ):
         obj = self.bus.get_object( "org.freesmartphone.frameworkd", object )
         return dbus.Interface( obj, interface )
 
+    def _shutdownFramework( self ):
+        self.controller.shutdown()
+        return False
+
     #
     # dbus methods
     #
@@ -186,7 +191,11 @@ class Framework( dbus.service.Object ):
 
     @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "s", "as" )
     def ListObjectsInSubsystem( self, subsystem ):
-        pass
+        raise dbus.DBusException( "not yet implemented" )
+
+    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "" )
+    def Shutdown( self ):
+        gobject.idle_add( self._shutdownFramework )
 
 #----------------------------------------------------------------------------#
 def factory( prefix, controller ):
diff --git a/framework/subsystem.py b/framework/subsystem.py
index eb3cb97..55450b4 100644
--- a/framework/subsystem.py
+++ b/framework/subsystem.py
@@ -49,6 +49,17 @@ class Subsystem( object ):
         self.launchTime = time.time() - self.launchTime
         logger.info( "subsystem %s took %.2f seconds to startup" % ( self.name, self.launchTime ) )
 
+    def shutdown( self ):
+        """
+        Shutdown the subsystems, giving objects a chance
+        to clean up behind them.
+        """
+        for o in self._objects.values():
+            try:
+                o.shutdown()
+            except AttributeError: # objects do not have to support this method
+                pass
+
     def objects( self ):
         return self._objects
 

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list