rpms/xfce-mcs-manager/devel xfce-mcs-manager-4.4.1-wakeups.patch, NONE, 1.1 xfce-mcs-manager.spec, 1.13, 1.14

Kevin Fenzi (kevin) fedora-extras-commits at redhat.com
Thu Aug 2 03:31:10 UTC 2007


Author: kevin

Update of /cvs/extras/rpms/xfce-mcs-manager/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31979

Modified Files:
	xfce-mcs-manager.spec 
Added Files:
	xfce-mcs-manager-4.4.1-wakeups.patch 
Log Message:
Add patch to fix excessive wakeups (fixes #250364)


xfce-mcs-manager-4.4.1-wakeups.patch:

--- NEW FILE xfce-mcs-manager-4.4.1-wakeups.patch ---
--- xfce-mcs-manager/xfce-mcs-manager/xfce-mcs-manager.c	(revision 24722)
+++ xfce-mcs-manager/xfce-mcs-manager/xfce-mcs-manager.c	(revision 25758)
@@ -79,14 +79,16 @@
 
 static McsManager *manager;
 
-static enum
+enum
 {
     NOSIGNAL,
     RESTART,
     QUIT,
     NUM_SIGNALS
-} sigstate = NOSIGNAL;
+};
 
+static int signal_pipe[2] = { -1, -1 };
+
 G_MODULE_EXPORT gchar * mcs_plugin_check_version (gint version)
 {
     if (XFCE_MCS_PLUGIN_VERSION == version)
@@ -311,6 +313,8 @@
 static void
 sighandler (int signo)
 {
+    guint32 sigstate;
+    
     switch (signo)
     {
         case SIGUSR1:
@@ -319,28 +323,46 @@
 
         default:
             sigstate = QUIT;
+            break;
     }
+    
+    write (signal_pipe[1], &sigstate, sizeof (sigstate));
 }
 
 static gboolean
-check_signal_state (void)
+signal_pipe_io (GIOChannel *source,
+                GIOCondition condition,
+                gpointer data)
 {
-    if (sigstate == RESTART)
+    guint32 sigstate = 0;
+    gsize bread = 0;
+    
+    if (G_IO_ERROR_NONE == g_io_channel_read (source, (gchar *)&sigstate,
+                                              sizeof (sigstate), &bread)
+        && sizeof (sigstate) == bread)
     {
-        /* unload all plugins and destroy the manager */
-        unload_plugins ();
-        mcs_manager_destroy (manager);
+        switch (sigstate)
+        {
+            case RESTART:
+                /* unload all plugins and destroy the manager */
+                unload_plugins ();
+                mcs_manager_destroy (manager);
 
-        /* just run the MCS manager from scratch */
-        execvp (rargv[0], rargv);
-        _exit (EXIT_SUCCESS);
+                /* just run the MCS manager from scratch */
+                execvp (rargv[0], rargv);
+                _exit (EXIT_SUCCESS);
+                break;
+            
+            case QUIT:
+                gtk_main_quit ();
+                break;
+            
+            default:
+                break;
+        }
+        
     }
-    else if (sigstate == QUIT)
-    {
-        gtk_main_quit ();
-        return FALSE;
-    }
-
+    
     return TRUE;
 }
 
@@ -354,6 +376,8 @@
     gboolean daemon_mode;
     gboolean std_mgr;
     int i;
+    GIOChannel *signal_io;
+    guint signal_watch = 0;
 
     /* save argv for restart */
     rargv = g_strdupv (argv);
@@ -400,6 +424,29 @@
 
     plugin_load_all ();
     gdk_flush ();
+    
+    if (pipe (signal_pipe))
+        g_warning ("Unable to create signal-watch pipe: %s.  Signals will be ignored.", strerror(errno));
+    else
+    {
+        /* set writing end to non-blocking */
+        int oldflags = fcntl (signal_pipe[1], F_GETFL);
+        if(fcntl (signal_pipe[1], F_SETFL, oldflags | O_NONBLOCK))
+        {
+            g_warning ("Unable to set signal-watch pipe to non-blocking mode: %s.  Signals will be ignored.", strerror(errno));
+            close (signal_pipe[0]);
+            close (signal_pipe[1]);
+        }
+        else
+        {
+            signal_io = g_io_channel_unix_new (signal_pipe[0]);
+            g_io_channel_set_encoding (signal_io, NULL, NULL);
+            g_io_channel_set_close_on_unref (signal_io, FALSE);
+            signal_watch = g_io_add_watch (signal_io, G_IO_IN | G_IO_PRI,
+                                           signal_pipe_io, NULL);
+            g_io_channel_unref (signal_io);
+        }
+    }
 
 #ifdef HAVE_SIGACTION
     act.sa_handler = sighandler;
@@ -453,11 +500,14 @@
     else
         g_message ("Daemon mode disabled (for debug purpose only!)");
 
-    /* Establish signal-check timer */
-    g_timeout_add (500, (GSourceFunc) check_signal_state, NULL);
-
     gtk_main ();
 
+    if (signal_watch) {
+        g_source_remove (signal_watch);
+        close (signal_pipe[0]);
+        close (signal_pipe[1]);
+    }
+
     unload_plugins ();
 
     mcs_manager_destroy (manager);


Index: xfce-mcs-manager.spec
===================================================================
RCS file: /cvs/extras/rpms/xfce-mcs-manager/devel/xfce-mcs-manager.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- xfce-mcs-manager.spec	19 Apr 2007 01:56:39 -0000	1.13
+++ xfce-mcs-manager.spec	2 Aug 2007 03:30:38 -0000	1.14
@@ -1,10 +1,11 @@
 Summary: Multi channel settings manager
 Name: xfce-mcs-manager
 Version: 4.4.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPL
 URL: http://www.xfce.org/
 Source0: http://www.xfce.org/archive/xfce-4.4.1/src/xfce-mcs-manager-4.4.1.tar.bz2
+Patch0: xfce-mcs-manager-4.4.1-wakeups.patch
 Group: User Interface/Desktops
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Requires: libxfce4mcs >= %{version}
@@ -31,6 +32,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .wakeups
 
 %build
 %configure
@@ -68,6 +70,9 @@
 %{_includedir}/xfce4/xfce-mcs-manager
 
 %changelog
+* Wed Aug 01 2007 Kevin Fenzi <kevin at tummy.com> - 4.4.1-2
+- Add patch to fix excessive wakeups (fixes #250364)
+
 * Sun Apr 15 2007 Kevin Fenzi <kevin at tummy.com> - 4.4.1-1
 - Update to 4.4.1
 - Own some unowned directories




More information about the fedora-extras-commits mailing list