From: Steve Langasek Date: Fri, 11 May 2012 07:38:17 +0000 (-0700) Subject: client: add new flush api X-Git-Tag: 0.8.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e274cda1eee35730faa47a10198c0740e635c724;p=thirdparty%2Fplymouth.git client: add new flush api 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. --- diff --git a/configure.ac b/configure.ac index 116a4f15..c37c694d 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 d76d32dc..5d3965d5 100644 --- a/src/client/ply-boot-client.c +++ b/src/client/ply-boot-client.c @@ -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) { diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h index 78fdd214..ca6f37a0 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);