banshee r3059 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.ServiceStack



Author: rubenv
Date: Sun Jan 27 08:51:53 2008
New Revision: 3059
URL: http://svn.gnome.org/viewvc/banshee?rev=3059&view=rev

Log:
2008-01-27  Ruben Vermeersch  <ruben savanne be>

	* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: C#'s
	lock statement is re-entrant. Therefore, there's no need to have both
	RegisterService and RegisterServiceNoLock.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Sun Jan 27 08:51:53 2008
@@ -88,7 +88,7 @@
                 foreach (Type type in service_types) {
                     uint timer_id = Log.DebugTimerStart (); 
                     IService service = (IService)Activator.CreateInstance (type);
-                    RegisterServiceNoLock (service);
+                    RegisterService (service);
                     Log.DebugTimerPrint (timer_id, String.Format (
                         "Core service started ({0}, {{0}})", service.ServiceName));
                     OnServiceStarted (service);
@@ -97,7 +97,7 @@
                 foreach (TypeExtensionNode node in extension_nodes) {
                     uint timer_id = Log.DebugTimerStart ();
                     IService service = (IService)node.CreateInstance (typeof (IService));
-                    RegisterServiceNoLock (service);
+                    RegisterService (service);
                     Log.DebugTimerPrint (timer_id, String.Format (
                         "Extension service started ({0}, {{0}})", service.ServiceName));
                     OnServiceStarted (service);
@@ -124,19 +124,14 @@
             }
         }
         
-        private static void RegisterServiceNoLock (IService service)
-        {
-            services.Add (service.ServiceName, service);
-            
-            if(service is IDBusExportable) {
-                DBusServiceManager.RegisterObject ((IDBusExportable)service);
-            }
-        }
-                    
         public static void RegisterService (IService service)
         {
             lock (self_mutex) {
-                RegisterServiceNoLock (service);
+                services.Add (service.ServiceName, service);
+                
+                if(service is IDBusExportable) {
+                    DBusServiceManager.RegisterObject ((IDBusExportable)service);
+                }
             }
         }
         
@@ -144,7 +139,7 @@
         {
             lock (self_mutex) {
                 if (is_initialized) {
-                    RegisterServiceNoLock (Activator.CreateInstance <T> ());
+                    RegisterService (Activator.CreateInstance <T> ());
                 } else {
                     service_types.Add (typeof (T));
                 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]