[gvfs] client: Use g_cond_wait in a loop
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] client: Use g_cond_wait in a loop
- Date: Tue, 23 May 2017 12:30:18 +0000 (UTC)
commit 0564c9c92ab85b6b73efc1116b223878a5a89626
Author: Ondrej Holy <oholy redhat com>
Date: Tue May 23 14:02:28 2017 +0200
client: Use g_cond_wait in a loop
The documentation says that g_cond_wait() must always be used in a loop,
but it isn't in some cases. Let's fix it.
common/gmountsource.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/common/gmountsource.c b/common/gmountsource.c
index 702864e..c5d9f1a 100644
--- a/common/gmountsource.c
+++ b/common/gmountsource.c
@@ -410,8 +410,9 @@ g_mount_source_ask_password (GMountSource *source,
flags,
ask_reply_sync,
&data);
-
- g_cond_wait (&data.cond, &data.mutex);
+
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);
@@ -572,8 +573,9 @@ g_mount_source_ask_question (GMountSource *source,
choices,
ask_reply_sync,
&data);
-
- g_cond_wait (&data.cond, &data.mutex);
+
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);
@@ -843,7 +845,8 @@ g_mount_source_show_processes (GMountSource *source,
ask_reply_sync,
&data);
- g_cond_wait (&data.cond, &data.mutex);
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]