[PATCH] New ply_boot_client_flush() method to flush outgoing requests before we exit()

Steve Langasek steve.langasek at canonical.com
Fri May 11 00:38:17 PDT 2012


Hi there,

Below please find a patch to plymouth to add a new function,
ply_boot_client_flush(), which is included in the build of
libply-boot-client on Ubuntu.

This was added in response to this bug:

  https://bugs.launchpad.net/ubuntu/+source/mountall/+bug/559761

In some cases, clients may need a way to ensure that messages to plymouthd
have been processed synchronously.  This added API call provides this.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org

From df9b57bf698f62275bcf868f573d451c117e38c3 Mon Sep 17 00:00:00 2001
From: Steve Langasek <steve.langasek at canonical.com>
Date: Wed, 9 May 2012 12:57:44 -0700
Subject: [PATCH] New ply_boot_client_flush() method to flush outgoing
 requests before we exit()

---
 configure.ac                 |    4 ++--
 src/client/ply-boot-client.c |   11 +++++++++++
 src/client/ply-boot-client.h |    1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 116a4f1..c37c694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c
index d76d32d..5d3965d 100644
--- a/src/client/ply-boot-client.c
+++ b/src/client/ply-boot-client.c
@@ -777,6 +777,17 @@ ply_boot_client_tell_daemon_about_error (ply_boot_client_t                  *cli
 }
 
 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)
 {
   assert (client != NULL);
diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h
index 78fdd21..ca6f37a 100644
--- a/src/client/ply-boot-client.h
+++ b/src/client/ply-boot-client.h
@@ -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);
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20120511/56e6a8fa/attachment.pgp>


More information about the plymouth mailing list