[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [PATCH] Create a loop for dbus and pump the loop to process all the
- From: David Cantrell <dcantrell redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: [PATCH] Create a loop for dbus and pump the loop to process all the
- Date: Thu, 15 Jan 2009 05:54:37 -1000
+1 from me as well as clumens from last night. The message never showed
up in the queue last night, so I reviewed it via fpaste.org.
Committed and built.
However, two anaconda people did review it before committing, so we held
to the rules.
Jesse Keating wrote:
> In a normal env, something like GTK processes all the dbus messages
> as part of it's main loop. We don't have anything like that in
> loader so we have to turn that crank manually, and enough times to
> clear out all the pending messages.
> ---
> loader/net.c | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/loader/net.c b/loader/net.c
> index eef0234..4d08d34 100644
> --- a/loader/net.c
> +++ b/loader/net.c
> @@ -1895,6 +1895,8 @@ int get_connection(iface_t *iface) {
> int count = 0;
> NMClient *client = NULL;
> NMState state;
> + GMainLoop *loop;
> + GMainContext *ctx;
>
> if (iface == NULL) {
> return 1;
> @@ -1921,8 +1923,21 @@ int get_connection(iface_t *iface) {
> return 2;
> }
>
> + /* Create a loop for processing dbus signals */
> + loop = g_main_loop_new(NULL, FALSE);
> + ctx = g_main_loop_get_context(loop);
> +
> + /* pump the loop until all the messages are clear */
> + while (g_main_context_pending (ctx)) {
> + g_main_context_iteration (ctx, FALSE);
> + }
> +
> /* send message and block until a reply or error comes back */
> while (count < 45) {
> + /* pump the loop again to clear the messages */
> + while (g_main_context_pending (ctx)) {
> + g_main_context_iteration (ctx, FALSE);
> + }
> state = nm_client_get_state(client);
>
> if (state == NM_STATE_CONNECTED) {
> @@ -1937,6 +1952,7 @@ int get_connection(iface_t *iface) {
> count++;
> }
>
> + g_main_loop_unref(loop);
> g_object_unref(client);
> return 3;
> }
--
David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]