From 52f98a340cf104ef32bd067a432ceea11669fa0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 9 Jan 2012 17:42:14 +0100 Subject: [PATCH spice-gtk] Log if condition wait got cancelled https://bugs.freedesktop.org/show_bug.cgi?id=44570 --- gtk/channel-base.c | 6 ++++-- gtk/decode-glz.c | 4 +++- gtk/spice-channel.c | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gtk/channel-base.c b/gtk/channel-base.c index 39b4a08..b244d23 100644 --- a/gtk/channel-base.c +++ b/gtk/channel-base.c @@ -129,8 +129,10 @@ void spice_channel_handle_wait_for_channels(SpiceChannel *channel, SpiceMsgIn *i }; SPICE_DEBUG("waiting for serial %lu (%d/%d)", data.wait->message_serial, i + 1, wfc->wait_count); - g_coroutine_condition_wait(&c->coroutine, wait_for_channel, &data); - SPICE_DEBUG("waiting for serial %lu, done", data.wait->message_serial); + if (g_coroutine_condition_wait(&c->coroutine, wait_for_channel, &data)) + SPICE_DEBUG("waiting for serial %lu, done", data.wait->message_serial); + else + SPICE_DEBUG("waiting for serial %lu, cancelled", data.wait->message_serial); } } diff --git a/gtk/decode-glz.c b/gtk/decode-glz.c index 377f7af..3b7c34b 100644 --- a/gtk/decode-glz.c +++ b/gtk/decode-glz.c @@ -153,7 +153,9 @@ static void *glz_decoder_window_bits(SpiceGlzDecoderWindow *w, uint64_t id, .id = id - dist, }; - g_coroutine_condition_wait(g_coroutine_self(), wait_for_image, &data); + if (!g_coroutine_condition_wait(g_coroutine_self(), wait_for_image, &data)) + SPICE_DEBUG("wait for image cancelled"); + slot = (id - dist) % w->nimages; } diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 1dadcf2..f4a1678 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1867,9 +1867,8 @@ static gboolean spice_channel_iterate(SpiceChannel *channel) GIOCondition ret; do { - /* freeze coroutine */ - if (c->state == SPICE_CHANNEL_STATE_MIGRATING) - g_coroutine_condition_wait(&c->coroutine, wait_migration, channel); + if (!g_coroutine_condition_wait(&c->coroutine, wait_migration, channel)) + SPICE_DEBUG("migration wait cancelled"); if (c->has_error) { SPICE_DEBUG("channel has error, breaking loop"); -- 1.7.7.5