[balsa/gtk3] Fix error and use lock only when using threads
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Fix error and use lock only when using threads
- Date: Sat, 16 Mar 2013 17:58:11 +0000 (UTC)
commit 51e2dc23a3b52acda2d91f58fadb4b9c883f053d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Mar 16 13:57:35 2013 -0400
Fix error and use lock only when using threads
* libbalsa/libbalsa-conf.c (libbalsa_conf_sync_idle_cb),
(libbalsa_conf_queue_sync): fix error and use lock only when
using threads.
ChangeLog | 6 ++++++
libbalsa/libbalsa-conf.c | 12 ++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2e08561..ff30b4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-03-16 Peter Bloomfield
+ * libbalsa/libbalsa-conf.c (libbalsa_conf_sync_idle_cb),
+ (libbalsa_conf_queue_sync): fix error and use lock only when
+ using threads.
+
+2013-03-16 Peter Bloomfield
+
Queue config syncs instead of syncing immediately, except on
exit cleanup
diff --git a/libbalsa/libbalsa-conf.c b/libbalsa/libbalsa-conf.c
index 4164c71..d4996aa 100644
--- a/libbalsa/libbalsa-conf.c
+++ b/libbalsa/libbalsa-conf.c
@@ -546,12 +546,16 @@ libbalsa_conf_sync(void)
}
static guint lbc_sync_idle_id;
+#ifdef BALSA_USE_THREADS
G_LOCK_DEFINE_STATIC(lbc_sync_idle_id);
+#endif /* BALSA_USE_THREADS */
static gboolean
libbalsa_conf_sync_idle_cb(gpointer data)
{
+#ifdef BALSA_USE_THREADS
G_LOCK(lbc_sync_idle_id);
+#endif /* BALSA_USE_THREADS */
#if DEBUG
g_print("%s id %d, will be cleared\n", __func__, lbc_sync_idle_id);
#endif /* DEBUG */
@@ -559,14 +563,20 @@ libbalsa_conf_sync_idle_cb(gpointer data)
g_source_remove(lbc_sync_idle_id);
lbc_sync_idle_id = 0;
}
+#ifdef BALSA_USE_THREADS
G_UNLOCK(lbc_sync_idle_id);
+#endif /* BALSA_USE_THREADS */
libbalsa_conf_sync();
+
+ return FALSE;
}
void
libbalsa_conf_queue_sync(void)
{
+#ifdef BALSA_USE_THREADS
G_LOCK(lbc_sync_idle_id);
+#endif /* BALSA_USE_THREADS */
#if DEBUG
g_print("%s id %d, will be set if zero\n", __func__, lbc_sync_idle_id);
#endif /* DEBUG */
@@ -576,5 +586,7 @@ libbalsa_conf_queue_sync(void)
#if DEBUG
g_print("%s id now %d\n", __func__, lbc_sync_idle_id);
#endif /* DEBUG */
+#ifdef BALSA_USE_THREADS
G_UNLOCK(lbc_sync_idle_id);
+#endif /* BALSA_USE_THREADS */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]