[evolution-kolab/ek-wip-porting] EBookBackendKolab: GLib 2.32 GMutex fixups
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] EBookBackendKolab: GLib 2.32 GMutex fixups
- Date: Fri, 15 Jun 2012 16:27:14 +0000 (UTC)
commit 45d7b7f9fa121e286c6dd4410ba4375fd44481f1
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Jun 15 18:12:17 2012 +0200
EBookBackendKolab: GLib 2.32 GMutex fixups
* g_mutex_new() / g_mutex_free() have been deprecated
in GLib 2.32 in favor of g_mutex_init() / g_mutex_clear()
src/addressbook/e-book-backend-kolab.c | 40 ++++++++------------------------
1 files changed, 10 insertions(+), 30 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 8a1688a..d7ec6e3 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -47,8 +47,8 @@
/* table of KolabMailAccess objects */
static GHashTable *koma_objects = NULL;
-static GMutex *koma_objects_lock = NULL;
-static GMutex *active_book_views_lock = NULL;
+static GMutex koma_objects_lock;
+static GMutex active_book_views_lock;
/*----------------------------------------------------------------------------*/
@@ -227,7 +227,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
self = E_BOOK_BACKEND_KOLAB (backend);
priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
- g_mutex_lock (koma_objects_lock);
+ g_mutex_lock (&koma_objects_lock);
/* to trigger eds to pass along username and password, set the property
* "auth" to "true" in the source setting:
@@ -380,7 +380,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
if (ksettings != NULL)
g_object_unref (ksettings);
- g_mutex_unlock (koma_objects_lock);
+ g_mutex_unlock (&koma_objects_lock);
if (c_url != NULL)
camel_url_free (c_url);
@@ -1076,7 +1076,7 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
self = E_BOOK_BACKEND_KOLAB (backend);
priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
- g_mutex_lock (active_book_views_lock);
+ g_mutex_lock (&active_book_views_lock);
g_object_ref (book_view); /* unref()d in stop_view() */
@@ -1117,7 +1117,7 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
e_data_book_view_notify_complete (book_view, notify_err);
- g_mutex_unlock (active_book_views_lock);
+ g_mutex_unlock (&active_book_views_lock);
if (notify_err != NULL)
g_error_free (notify_err);
@@ -1141,13 +1141,13 @@ e_book_backend_kolab_stop_book_view (EBookBackend *backend,
self = E_BOOK_BACKEND_KOLAB (backend);
priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
- g_mutex_lock (active_book_views_lock);
+ g_mutex_lock (&active_book_views_lock);
e_data_book_view_notify_complete (book_view, NULL);
g_object_unref (book_view); /* ref()d in start_view() */
- g_mutex_unlock (active_book_views_lock);
+ g_mutex_unlock (&active_book_views_lock);
}
/*----------------------------------------------------------------------------*/
@@ -1158,33 +1158,13 @@ e_book_backend_kolab_init (EBookBackendKolab *backend)
{
EBookBackendKolabPrivate *priv = E_BOOK_BACKEND_KOLAB_PRIVATE (backend);
- /* We're inside a thread, and each of our siblings
- * (other configured ECalBackendKolab instances) is
- * so as well. Depending on how the threads are
- * started, checking for lock existence (and creating
- * one if it is not) in *this* place can still be
- * racy. Let's hope the threads are started one
- * at a time, in which case this solution will work.
- * The whole handling of living KolabMailAccess
- * instances would better be moved to a separate
- * library...
- *
- */
- if (koma_objects_lock == NULL)
- koma_objects_lock = g_mutex_new ();
- g_mutex_lock (koma_objects_lock);
+ g_mutex_lock (&koma_objects_lock);
if (koma_objects == NULL)
koma_objects = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
g_free,
g_object_unref);
- g_mutex_unlock (koma_objects_lock);
- /* active cal views are shared in the same way,
- * so we do the locking for them analogous
- * to the KolabMailAccess instances
- */
- if (active_book_views_lock == NULL)
- active_book_views_lock = g_mutex_new ();
+ g_mutex_unlock (&koma_objects_lock);
g_debug ("%s()[%u] called.", __func__, __LINE__);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]