rpms/ConsoleKit/F-9 ck-exit-with-bus.patch, NONE, 1.1 ck-fix-thread-shutdown.patch, NONE, 1.1 ConsoleKit.spec, 1.27, 1.28
William Jon McCann (mccann)
fedora-extras-commits at redhat.com
Mon May 5 19:45:40 UTC 2008
Author: mccann
Update of /cvs/pkgs/rpms/ConsoleKit/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7313
Modified Files:
ConsoleKit.spec
Added Files:
ck-exit-with-bus.patch ck-fix-thread-shutdown.patch
Log Message:
- Exit with system bus (#441571)
- Correctly shutdown event logger threads (#440349)
ck-exit-with-bus.patch:
--- NEW FILE ck-exit-with-bus.patch ---
diff --git a/src/main.c b/src/main.c
index adc0d71..809c6d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,9 +44,6 @@
#define CK_DBUS_NAME "org.freedesktop.ConsoleKit"
-static void bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
- CkManager *manager);
-
static gboolean
timed_exit_cb (GMainLoop *loop)
{
@@ -138,60 +135,12 @@ get_system_bus (void)
return bus;
}
-static gboolean
-bus_reconnect (CkManager *manager)
-{
- DBusGConnection *bus;
- DBusGProxy *bus_proxy;
- gboolean ret;
-
- ret = TRUE;
-
- bus = get_system_bus ();
- if (bus == NULL) {
- goto out;
- }
-
- bus_proxy = get_bus_proxy (bus);
- if (bus_proxy == NULL) {
- g_warning ("Could not construct bus_proxy object; will retry");
- goto out;
- }
-
- if (! acquire_name_on_proxy (bus_proxy) ) {
- g_warning ("Could not acquire name; will retry");
- goto out;
- }
-
- manager = ck_manager_new ();
- if (manager == NULL) {
- g_warning ("Could not construct manager object");
- exit (1);
- }
-
- g_signal_connect (bus_proxy,
- "destroy",
- G_CALLBACK (bus_proxy_destroyed_cb),
- manager);
-
- g_debug ("Successfully reconnected to D-Bus");
-
- ret = FALSE;
-
- out:
- return ret;
-}
-
static void
bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
- CkManager *manager)
+ GMainLoop *loop)
{
g_debug ("Disconnected from D-Bus");
-
- g_object_unref (manager);
- manager = NULL;
-
- g_timeout_add (3000, (GSourceFunc)bus_reconnect, manager);
+ g_main_loop_quit (loop);
}
static void
@@ -371,12 +320,12 @@ main (int argc,
goto out;
}
+ loop = g_main_loop_new (NULL, FALSE);
+
g_signal_connect (bus_proxy,
"destroy",
G_CALLBACK (bus_proxy_destroyed_cb),
- manager);
-
- loop = g_main_loop_new (NULL, FALSE);
+ loop);
if (do_timed_exit) {
g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, loop);
@@ -384,7 +333,9 @@ main (int argc,
g_main_loop_run (loop);
- g_object_unref (manager);
+ if (manager != NULL) {
+ g_object_unref (manager);
+ }
g_main_loop_unref (loop);
ck-fix-thread-shutdown.patch:
--- NEW FILE ck-fix-thread-shutdown.patch ---
diff --git a/src/ck-event-logger.c b/src/ck-event-logger.c
index 2fded87..92bf987 100644
--- a/src/ck-event-logger.c
+++ b/src/ck-event-logger.c
@@ -254,12 +254,16 @@ writer_thread_start (CkEventLogger *event_logger)
{
CkLogEvent *event;
- while ((event = g_async_queue_pop (event_logger->priv->event_queue)) != NULL) {
+ while (1) {
+ event = g_async_queue_pop (event_logger->priv->event_queue);
+ if (event == NULL || event->type == CK_LOG_EVENT_NONE) {
+ break;
+ }
write_log_for_event (event_logger, event);
ck_log_event_free (event);
}
- g_thread_exit (NULL);
+ g_debug ("Writer thread received None event - exiting");
return NULL;
}
@@ -274,7 +278,7 @@ create_writer_thread (CkEventLogger *event_logger)
event_logger->priv->writer_thread = g_thread_create_full ((GThreadFunc)writer_thread_start,
event_logger,
65536,
- FALSE,
+ TRUE,
TRUE,
G_THREAD_PRIORITY_NORMAL,
&error);
@@ -284,6 +288,22 @@ create_writer_thread (CkEventLogger *event_logger)
}
}
+static void
+destroy_writer_thread (CkEventLogger *event_logger)
+{
+ CkLogEvent event;
+
+ event.type = CK_LOG_EVENT_NONE;
+
+ g_debug ("Destroying writer thread");
+ g_async_queue_push (event_logger->priv->event_queue,
+ &event);
+#if 1
+ g_debug ("Joining writer thread");
+ g_thread_join (event_logger->priv->writer_thread);
+#endif
+}
+
static GObject *
ck_event_logger_constructor (GType type,
guint n_construct_properties,
@@ -394,6 +414,8 @@ ck_event_logger_finalize (GObject *object)
g_return_if_fail (event_logger->priv != NULL);
+ destroy_writer_thread (event_logger);
+
if (event_logger->priv->event_queue != NULL) {
g_async_queue_unref (event_logger->priv->event_queue);
}
diff --git a/src/ck-log-event.h b/src/ck-log-event.h
index 149f49b..64dec58 100644
--- a/src/ck-log-event.h
+++ b/src/ck-log-event.h
@@ -27,7 +27,8 @@ G_BEGIN_DECLS
typedef enum
{
- CK_LOG_EVENT_START = 0,
+ CK_LOG_EVENT_NONE = 0,
+ CK_LOG_EVENT_START,
CK_LOG_EVENT_STOP,
CK_LOG_EVENT_SYSTEM_START,
CK_LOG_EVENT_SYSTEM_STOP,
@@ -44,6 +45,10 @@ typedef enum
typedef struct
{
+} CkLogNoneEvent;
+
+typedef struct
+{
} CkLogSystemStopEvent;
typedef struct
@@ -117,6 +122,7 @@ typedef struct
typedef struct
{
union {
+ CkLogNoneEvent none;
CkLogSystemRestartEvent system_start;
CkLogSystemStopEvent system_stop;
CkLogSystemRestartEvent system_restart;
Index: ConsoleKit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ConsoleKit/F-9/ConsoleKit.spec,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ConsoleKit.spec 6 Apr 2008 02:30:05 -0000 1.27
+++ ConsoleKit.spec 5 May 2008 19:44:56 -0000 1.28
@@ -25,6 +25,8 @@
BuildRequires: xmlto
Patch0: polkit-result.patch
+Patch1: ck-exit-with-bus.patch
+Patch2: ck-fix-thread-shutdown.patch
%description
ConsoleKit is a system daemon for tracking what users are logged
@@ -78,6 +80,8 @@
%prep
%setup -q
%patch0 -p1 -b .polkit-result
+%patch1 -p1 -b .exit-with-bus
+%patch2 -p1 -b .thread-shutdown
%build
%configure --with-pid-file=%{_localstatedir}/run/console-kit-daemon.pid --enable-pam-module --with-pam-module-dir=/%{_lib}/security --enable-docbook-docs --docdir=%{_datadir}/doc/%{name}-%{version}
@@ -157,6 +161,10 @@
%doc %{_datadir}/doc/%{name}-%{version}/spec/*
%changelog
+* Mon May 5 2008 Jon McCann <jmccann at redhat.com> - 0.2.10-4
+- Exit with system bus (#441571)
+- Correctly shutdown event logger threads (#440349)
+
* Sat Apr 5 2008 Matthias Clasen <mclasen at redhat.com> - 0.2.10-3
- Return PolicyKit results
More information about the fedora-extras-commits
mailing list