]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
client: add new flush api
authorSteve Langasek <steve.langasek@canonical.com>
Fri, 11 May 2012 07:38:17 +0000 (00:38 -0700)
committerRay Strode <rstrode@redhat.com>
Fri, 11 May 2012 12:48:02 +0000 (08:48 -0400)
In some cases, clients may need a way to ensure that all queued
messages have been flushed and are sent to the daemon
(before, for instance, exiting).

This commit adds an API to block until the outgoing request queue is
empty.

configure.ac
src/client/ply-boot-client.c
src/client/ply-boot-client.h

index 116a4f15b07fd6996f308ed84b149cbada1280ce..c37c694dbfe680e6b7242d410575e907e66ba9c8 100644 (file)
@@ -19,7 +19,7 @@ PKG_PROG_PKG_CONFIG
 LT_INIT
 
 ## increment if the interface has additions, changes, removals.
-LT_CURRENT=2
+LT_CURRENT=3
 
 ## increment any time the source changes; set to
 ##  0 if you increment CURRENT
@@ -28,7 +28,7 @@ LT_REVISION=0
 ## increment if any interfaces have been added; set to 0
 ## if any interfaces have been changed or removed. removal has
 ## precedence over adding, so set to 0 if both happened.
-LT_AGE=0
+LT_AGE=1
 
 AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
index d76d32dcfc482d48b61a22952e413c14523793f9..5d3965d5cc215798698b76351e9048ea106fa8a3 100644 (file)
@@ -776,6 +776,17 @@ ply_boot_client_tell_daemon_about_error (ply_boot_client_t                  *cli
                                  NULL, handler, failed_handler, user_data);
 }
 
+void
+ply_boot_client_flush (ply_boot_client_t *client)
+{
+  assert (client != NULL);
+
+  while (ply_list_get_length (client->requests_to_send) > 0)
+    {
+      ply_event_loop_process_pending_events (client->loop);
+    }
+}
+
 void
 ply_boot_client_disconnect (ply_boot_client_t *client)
 {
index 78fdd214c3c7d7c2401fca58ef321b9a28c9aa51..ca6f37a0da5907231334abfaa24f4ec9e37773aa 100644 (file)
@@ -134,6 +134,7 @@ void ply_boot_client_ask_daemon_has_active_vt (ply_boot_client_t
                                                ply_boot_client_response_handler_t  handler,
                                                ply_boot_client_response_handler_t  failed_handler,
                                                void                               *user_data);
+void ply_boot_client_flush (ply_boot_client_t *client);
 void ply_boot_client_disconnect (ply_boot_client_t *client);
 void ply_boot_client_attach_to_event_loop (ply_boot_client_t *client,
                                            ply_event_loop_t  *loop);