** Fixes bug #356177
authorMatthew Barnes <mbarnes@redhat.com>
Fri, 23 Feb 2007 18:06:18 +0000 (18:06 +0000)
committerMatthew Barnes <mbarnes@src.gnome.org>
Fri, 23 Feb 2007 18:06:18 +0000 (18:06 +0000)
2007-02-23  Matthew Barnes  <mbarnes@redhat.com>

** Fixes bug #356177

* libedataserver/e-msgport.h: Deprecate EMutex.

* camel/camel-folder.c:
* camel/camel-object.c:
* camel/camel-private.h:
* camel/camel-provider.c:
* camel/camel-service.c:
* camel/camel-store.c:
* camel/camel-text-index.c:
* camel/providers/groupwise/camel-groupwise-folder.c:
* camel/providers/groupwise/camel-groupwise-private.h:
* camel/providers/groupwise/camel-groupwise-store.c:
* camel/providers/imap/camel-imap-command.c:
* camel/providers/imap/camel-imap-folder.c:
* camel/providers/imap/camel-imap-private.h:
* camel/providers/imap/camel-imap-store.c:
* camel/providers/imap4/camel-imap4-folder.c:
* camel/providers/imap4/camel-imap4-store.c:
* camel/providers/nntp/camel-nntp-folder.c:
* camel/providers/nntp/camel-nntp-store.c:
Migrate from EMutex to GStaticMutex or GStaticRecMutex.

svn path=/trunk/; revision=7628

25 files changed:
ChangeLog
camel/ChangeLog
camel/camel-folder.c
camel/camel-object.c
camel/camel-private.h
camel/camel-provider.c
camel/camel-service.c
camel/camel-store.c
camel/camel-text-index.c
camel/providers/groupwise/ChangeLog
camel/providers/groupwise/camel-groupwise-folder.c
camel/providers/groupwise/camel-groupwise-private.h
camel/providers/groupwise/camel-groupwise-store.c
camel/providers/imap/ChangeLog
camel/providers/imap/camel-imap-command.c
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-private.h
camel/providers/imap/camel-imap-store.c
camel/providers/imap4/ChangeLog
camel/providers/imap4/camel-imap4-folder.c
camel/providers/imap4/camel-imap4-store.c
camel/providers/nntp/ChangeLog
camel/providers/nntp/camel-nntp-folder.c
camel/providers/nntp/camel-nntp-store.c
libedataserver/e-msgport.h

index aab2bba..72006f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Fixes bug #356177
+
+       * libedataserver/e-msgport.h: Deprecate EMutex.
+
 2007-02-12  Srinivasa Ragavan <sragavan@novell.com>
 
        * NEWS, configure.in: Evolution-Data-Server 1.9.91 
index cec6233..a7918f9 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Fixes bug #356177
+
+       * camel-folder.c:
+       * camel-object.c:
+       * camel-private.h:
+       * camel-provider.c:
+       * camel-service.c:
+       * camel-store.c:
+       * camel-text-index.c:
+       Migrate from EMutex to GStaticMutex or GStaticRecMutex.
+
 2006-01-08  Veerapuram Varadhan  <vvaradhan@novell.com>
 
        ** Fixes eds part of bgo #362638 - Patch submitted by Matthew
index d9c8eb1..329cf24 100644 (file)
@@ -171,8 +171,8 @@ camel_folder_init (gpointer object, gpointer klass)
        folder->priv = g_malloc0(sizeof(*folder->priv));
        folder->priv->frozen = 0;
        folder->priv->changed_frozen = camel_folder_change_info_new();
-       folder->priv->lock = e_mutex_new(E_MUTEX_REC);
-       folder->priv->change_lock = e_mutex_new(E_MUTEX_SIMPLE);
+       g_static_rec_mutex_init(&folder->priv->lock);
+       g_static_mutex_init(&folder->priv->change_lock);
 }
 
 static void
@@ -193,8 +193,8 @@ camel_folder_finalize (CamelObject *object)
 
        camel_folder_change_info_free(p->changed_frozen);
        
-       e_mutex_destroy(p->lock);
-       e_mutex_destroy(p->change_lock);
+       g_static_rec_mutex_free(&p->lock);
+       g_static_mutex_free(&p->change_lock);
        
        g_free(p);
 }
@@ -267,12 +267,12 @@ camel_folder_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
-       CAMEL_FOLDER_LOCK(folder, lock);
+       CAMEL_FOLDER_REC_LOCK(folder, lock);
        
        if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED))
                CF_CLASS (folder)->sync (folder, expunge, ex);
        
-       CAMEL_FOLDER_UNLOCK(folder, lock);
+       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 }
 
 
@@ -529,12 +529,12 @@ camel_folder_expunge (CamelFolder *folder, CamelException *ex)
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
        
-       CAMEL_FOLDER_LOCK(folder, lock);
+       CAMEL_FOLDER_REC_LOCK(folder, lock);
        
        if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED))
                CF_CLASS (folder)->expunge (folder, ex);
        
-       CAMEL_FOLDER_UNLOCK(folder, lock);
+       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 }
 
 static int
@@ -643,11 +643,11 @@ camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message,
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
-       CAMEL_FOLDER_LOCK(folder, lock);
+       CAMEL_FOLDER_REC_LOCK(folder, lock);
 
        CF_CLASS (folder)->append_message (folder, message, info, appended_uid, ex);
 
-       CAMEL_FOLDER_UNLOCK(folder, lock);
+       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 }
 
 
@@ -1065,11 +1065,11 @@ camel_folder_get_message (CamelFolder *folder, const char *uid, CamelException *
 
        g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 
-       CAMEL_FOLDER_LOCK(folder, lock);
+       CAMEL_FOLDER_REC_LOCK(folder, lock);
 
        ret = CF_CLASS (folder)->get_message (folder, uid, ex);
 
-       CAMEL_FOLDER_UNLOCK(folder, lock);
+       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 
        if (ret && camel_debug_start(":folder")) {
                printf("CamelFolder:get_message('%s', '%s') =\n", folder->full_name, uid);
@@ -1474,9 +1474,9 @@ camel_folder_delete (CamelFolder *folder)
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
        
-       CAMEL_FOLDER_LOCK (folder, lock);
+       CAMEL_FOLDER_REC_LOCK (folder, lock);
        if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED) {
-               CAMEL_FOLDER_UNLOCK (folder, lock);
+               CAMEL_FOLDER_REC_UNLOCK (folder, lock);
                return;
        }
        
@@ -1484,7 +1484,7 @@ camel_folder_delete (CamelFolder *folder)
        
        CF_CLASS (folder)->delete (folder);
 
-       CAMEL_FOLDER_UNLOCK (folder, lock);
+       CAMEL_FOLDER_REC_UNLOCK (folder, lock);
 
        camel_object_trigger_event (folder, "deleted", NULL);
 }
index 86bc9cf..7933f6f 100644 (file)
@@ -52,7 +52,7 @@
 
 /* A 'locked' hooklist, that is only allocated on demand */
 typedef struct _CamelHookList {
-       EMutex *lock;
+       GStaticRecMutex lock;
 
        unsigned int depth:30;  /* recursive event depth */
        unsigned int flags:2;   /* flags, see below */
@@ -125,7 +125,8 @@ static CamelHookList *camel_object_get_hooks(CamelObject *o);
 static void camel_object_free_hooks(CamelObject *o);
 static void camel_object_bag_remove_unlocked(CamelObjectBag *inbag, CamelObject *o, CamelHookList *hooks);
 
-#define camel_object_unget_hooks(o) (e_mutex_unlock((CAMEL_OBJECT(o)->hooks->lock)))
+#define camel_object_unget_hooks(o) \
+       (g_static_rec_mutex_unlock(&CAMEL_OBJECT(o)->hooks->lock))
 
 
 /* ********************************************************************** */
@@ -137,7 +138,7 @@ static EMemChunk *hook_chunks;
 static unsigned int pair_id = 1;
 
 /* type-lock must be recursive, for atomically creating classes */
-static EMutex *type_lock;
+static GStaticRecMutex type_lock = G_STATIC_REC_MUTEX_INIT;
 /* ref-lock must be global :-(  for object bags to work */
 static GMutex *ref_lock;
 
@@ -150,12 +151,12 @@ CamelType camel_interface_type;
 
 #define P_LOCK(l) (pthread_mutex_lock(&l))
 #define P_UNLOCK(l) (pthread_mutex_unlock(&l))
-#define E_LOCK(l) (e_mutex_lock(l))
-#define E_UNLOCK(l) (e_mutex_unlock(l))
 #define CLASS_LOCK(k) (g_mutex_lock((((CamelObjectClass *)k)->lock)))
 #define CLASS_UNLOCK(k) (g_mutex_unlock((((CamelObjectClass *)k)->lock)))
 #define REF_LOCK() (g_mutex_lock(ref_lock))
 #define REF_UNLOCK() (g_mutex_unlock(ref_lock))
+#define TYPE_LOCK() (g_static_rec_mutex_lock(&type_lock))
+#define TYPE_UNLOCK() (g_static_rec_mutex_unlock(&type_lock))
 
 static struct _CamelHookPair *
 pair_alloc(void)
@@ -216,7 +217,6 @@ camel_type_init(void)
        init = TRUE;
        pair_chunks = e_memchunk_new(16, sizeof(CamelHookPair));
        hook_chunks = e_memchunk_new(16, sizeof(CamelHookList));
-       type_lock = e_mutex_new(E_MUTEX_REC);
        type_chunks = e_memchunk_new(32, sizeof(CamelType));
        type_table = g_hash_table_new(NULL, NULL);
        ref_lock = g_mutex_new();
@@ -723,7 +723,7 @@ co_type_register(CamelType parent, const char * name,
        /*int offset;
          size_t size;*/
 
-       E_LOCK(type_lock);
+       TYPE_LOCK();
 
        /* Have to check creation, it might've happened in another thread before we got here */
        klass = g_hash_table_lookup(type_table, name);
@@ -734,7 +734,7 @@ co_type_register(CamelType parent, const char * name,
                        g_warning("camel_type_register: Trying to re-register class '%s'", name);
                        klass = NULL;
                }
-               E_UNLOCK(type_lock);
+               TYPE_UNLOCK();
                return klass;
        }
 
@@ -758,7 +758,7 @@ co_type_register(CamelType parent, const char * name,
        if (parent
            && klass_size < parent->klass_size) {
                g_warning("camel_type_register: '%s' has smaller class size than parent '%s'", name, parent->name);
-               E_UNLOCK(type_lock);
+               TYPE_UNLOCK();
                return NULL;
        }
 
@@ -789,7 +789,7 @@ co_type_register(CamelType parent, const char * name,
 
        camel_type_class_init(klass, klass);
 
-       E_UNLOCK(type_lock);
+       TYPE_UNLOCK();
 
        return klass;
 }
@@ -1254,7 +1254,7 @@ camel_object_free_hooks(CamelObject *o)
                        pair_free(pair);
                        pair = next;
                }
-               e_mutex_destroy(o->hooks->lock);
+               g_static_rec_mutex_free(&o->hooks->lock);
                hooks_free(o->hooks);
                o->hooks = NULL;
        }
@@ -1273,7 +1273,7 @@ camel_object_get_hooks(CamelObject *o)
                pthread_mutex_lock(&lock);
                if (o->hooks == NULL) {
                        hooks = hooks_alloc();
-                       hooks->lock = e_mutex_new(E_MUTEX_REC);
+                       g_static_rec_mutex_init(&hooks->lock);
                        hooks->flags = 0;
                        hooks->depth = 0;
                        hooks->list_length = 0;
@@ -1283,7 +1283,7 @@ camel_object_get_hooks(CamelObject *o)
                pthread_mutex_unlock(&lock);
        }
        
-       e_mutex_lock(o->hooks->lock);
+       g_static_rec_mutex_lock(&o->hooks->lock);
        
        return o->hooks;        
 }
index e0a5f47..0ea46a9 100644 (file)
@@ -39,23 +39,31 @@ extern "C" {
 #include <libedataserver/e-msgport.h>
 
 struct _CamelFolderPrivate {
-       EMutex *lock;
-       EMutex *change_lock;
+       GStaticRecMutex lock;
+       GStaticMutex change_lock;
        /* must require the 'change_lock' to access this */
        int frozen;
        struct _CamelFolderChangeInfo *changed_frozen; /* queues changed events */
 };
 
-#define CAMEL_FOLDER_LOCK(f, l) (e_mutex_lock(((CamelFolder *)f)->priv->l))
-#define CAMEL_FOLDER_UNLOCK(f, l) (e_mutex_unlock(((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_LOCK(f, l) \
+       (g_static_mutex_lock(&((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_UNLOCK(f, l) \
+       (g_static_mutex_unlock(&((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_REC_LOCK(f, l) \
+       (g_static_rec_mutex_lock(&((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_REC_UNLOCK(f, l) \
+       (g_static_rec_mutex_unlock(&((CamelFolder *)f)->priv->l))
 
 
 struct _CamelStorePrivate {
-       EMutex *folder_lock;    /* for locking folder operations */
+       GStaticRecMutex folder_lock;    /* for locking folder operations */
 };
 
-#define CAMEL_STORE_LOCK(f, l) (e_mutex_lock(((CamelStore *)f)->priv->l))
-#define CAMEL_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelStore *)f)->priv->l))
+#define CAMEL_STORE_LOCK(f, l) \
+       (g_static_rec_mutex_lock(&((CamelStore *)f)->priv->l))
+#define CAMEL_STORE_UNLOCK(f, l) \
+       (g_static_rec_mutex_unlock(&((CamelStore *)f)->priv->l))
 
 
 struct _CamelTransportPrivate {
@@ -67,13 +75,18 @@ struct _CamelTransportPrivate {
 
 
 struct _CamelServicePrivate {
-       EMutex *connect_lock;   /* for locking connection operations */
-       EMutex *connect_op_lock;/* for locking the connection_op */
+       GStaticRecMutex connect_lock;   /* for locking connection operations */
+       GStaticMutex connect_op_lock;   /* for locking the connection_op */
 };
 
-#define CAMEL_SERVICE_LOCK(f, l) (e_mutex_lock(((CamelService *)f)->priv->l))
-#define CAMEL_SERVICE_UNLOCK(f, l) (e_mutex_unlock(((CamelService *)f)->priv->l))
-#define CAMEL_SERVICE_ASSERT_LOCKED(f, l) (e_mutex_assert_locked (((CamelService *)f)->priv->l))
+#define CAMEL_SERVICE_LOCK(f, l) \
+       (g_static_mutex_lock(&((CamelService *)f)->priv->l))
+#define CAMEL_SERVICE_UNLOCK(f, l) \
+       (g_static_mutex_unlock(&((CamelService *)f)->priv->l))
+#define CAMEL_SERVICE_REC_LOCK(f, l) \
+       (g_static_rec_mutex_lock(&((CamelService *)f)->priv->l))
+#define CAMEL_SERVICE_REC_UNLOCK(f, l) \
+       (g_static_rec_mutex_unlock(&((CamelService *)f)->priv->l))
 
 
 struct _CamelSessionPrivate {
index 2c4c760..8639229 100644 (file)
 static GHashTable *module_table;
 /* table of CamelProvider's */
 static GHashTable *provider_table;
-static EMutex *provider_lock;
+static GStaticRecMutex provider_lock = G_STATIC_REC_MUTEX_INIT;
 
-#define LOCK() e_mutex_lock(provider_lock);
-#define UNLOCK() e_mutex_unlock(provider_lock);
+#define LOCK()         (g_static_rec_mutex_lock(&provider_lock))
+#define UNLOCK()       (g_static_rec_mutex_unlock(&provider_lock))
 
 /* The vfolder provider is always available */
 static CamelProvider vee_provider = {
@@ -76,7 +76,6 @@ static pthread_once_t setup_once = PTHREAD_ONCE_INIT;
 static void
 provider_setup(void)
 {
-       provider_lock = e_mutex_new(E_MUTEX_REC);
        module_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
        provider_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
 
index 9113ab7..4c1f4a3 100644 (file)
@@ -93,8 +93,8 @@ camel_service_init (void *o, void *k)
        CamelService *service = o;
        
        service->priv = g_malloc0(sizeof(*service->priv));
-       service->priv->connect_lock = e_mutex_new(E_MUTEX_REC);
-       service->priv->connect_op_lock = e_mutex_new(E_MUTEX_SIMPLE);
+       g_static_rec_mutex_init(&service->priv->connect_lock);
+       g_static_mutex_init(&service->priv->connect_op_lock);
 }
 
 static void
@@ -119,8 +119,8 @@ camel_service_finalize (CamelObject *object)
        if (service->session)
                camel_object_unref (service->session);
        
-       e_mutex_destroy (service->priv->connect_lock);
-       e_mutex_destroy (service->priv->connect_op_lock);
+       g_static_rec_mutex_free (&service->priv->connect_lock);
+       g_static_mutex_free (&service->priv->connect_op_lock);
        
        g_free (service->priv);
 }
@@ -346,10 +346,10 @@ camel_service_connect (CamelService *service, CamelException *ex)
        g_return_val_if_fail (service->session != NULL, FALSE);
        g_return_val_if_fail (service->url != NULL, FALSE);
        
-       CAMEL_SERVICE_LOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (service, connect_lock);
        
        if (service->status == CAMEL_SERVICE_CONNECTED) {
-               CAMEL_SERVICE_UNLOCK (service, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
                return TRUE;
        }
 
@@ -379,7 +379,7 @@ camel_service_connect (CamelService *service, CamelException *ex)
        }
        CAMEL_SERVICE_UNLOCK (service, connect_op_lock);
 
-       CAMEL_SERVICE_UNLOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
        
        return ret;
 }
@@ -415,7 +415,7 @@ camel_service_disconnect (CamelService *service, gboolean clean,
        gboolean res = TRUE;
        int unreg = FALSE;
 
-       CAMEL_SERVICE_LOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (service, connect_lock);
        
        if (service->status != CAMEL_SERVICE_DISCONNECTED
            && service->status != CAMEL_SERVICE_DISCONNECTING) {
@@ -441,7 +441,7 @@ camel_service_disconnect (CamelService *service, gboolean clean,
                CAMEL_SERVICE_UNLOCK (service, connect_op_lock);
        }
        
-       CAMEL_SERVICE_UNLOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
        
                service->status = CAMEL_SERVICE_DISCONNECTED;
        return res;
@@ -638,9 +638,9 @@ camel_service_query_auth_types (CamelService *service, CamelException *ex)
        
        /* note that we get the connect lock here, which means the callee
           must not call the connect functions itself */
-       CAMEL_SERVICE_LOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (service, connect_lock);
        ret = CSERV_CLASS (service)->query_auth_types (service, ex);
-       CAMEL_SERVICE_UNLOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
        
        return ret;
 }
index a1699f7..0eb1d1b 100644 (file)
@@ -140,7 +140,7 @@ camel_store_init (void *o)
        store->mode = CAMEL_STORE_READ|CAMEL_STORE_WRITE;
 
        store->priv = g_malloc0 (sizeof (*store->priv));
-       store->priv->folder_lock = e_mutex_new (E_MUTEX_REC);
+       g_static_rec_mutex_init (&store->priv->folder_lock);
 }
 
 static void
@@ -151,7 +151,7 @@ camel_store_finalize (CamelObject *object)
        if (store->folders)
                camel_object_bag_destroy(store->folders);
        
-       e_mutex_destroy (store->priv->folder_lock);
+       g_static_rec_mutex_free (&store->priv->folder_lock);
        
        g_free (store->priv);
 }
@@ -472,7 +472,7 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char
                                && strncmp(folder->full_name, old_name, oldlen) == 0
                                && folder->full_name[oldlen] == '/')) {
                                d(printf("Found subfolder of '%s' == '%s'\n", old_name, folder->full_name));
-                               CAMEL_FOLDER_LOCK(folder, lock);
+                               CAMEL_FOLDER_REC_LOCK(folder, lock);
                        } else {
                                g_ptr_array_remove_index_fast(folders, i);
                                i--;
@@ -499,7 +499,7 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char
                        camel_folder_rename(folder, new);
                        g_free(new);
 
-                       CAMEL_FOLDER_UNLOCK(folder, lock);
+                       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
                        camel_object_unref(folder);
                }
 
@@ -517,7 +517,7 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char
                /* Failed, just unlock our folders for re-use */
                for (i=0;i<folders->len;i++) {
                        folder = folders->pdata[i];
-                       CAMEL_FOLDER_UNLOCK(folder, lock);
+                       CAMEL_FOLDER_REC_UNLOCK(folder, lock);
                        camel_object_unref(folder);
                }
        }
index 264716d..9bda078 100644 (file)
 
 #define CAMEL_TEXT_INDEX_MAX_WORDLEN  (36)
 
-#define CAMEL_TEXT_INDEX_LOCK(kf, lock) (e_mutex_lock(((CamelTextIndex *)kf)->priv->lock))
-#define CAMEL_TEXT_INDEX_UNLOCK(kf, lock) (e_mutex_unlock(((CamelTextIndex *)kf)->priv->lock))
+#define CAMEL_TEXT_INDEX_LOCK(kf, lock) \
+       (g_static_rec_mutex_lock(&((CamelTextIndex *)kf)->priv->lock))
+#define CAMEL_TEXT_INDEX_UNLOCK(kf, lock) \
+       (g_static_rec_mutex_unlock(&((CamelTextIndex *)kf)->priv->lock))
 
 static int text_index_compress_nosync(CamelIndex *idx);
 
@@ -125,7 +127,7 @@ struct _CamelTextIndexPrivate {
        int word_cache_count;
        EDList word_cache;
        GHashTable *words;
-       EMutex *lock;
+       GStaticRecMutex lock;
 };
 
 /* Root block of text index */
@@ -760,7 +762,7 @@ camel_text_index_init(CamelTextIndex *idx)
           with moderate memory usage.  Doubling the memory usage barely affects performance. */
        p->word_cache_limit = 4096; /* 1024 = 128K */
        
-       p->lock = e_mutex_new(E_MUTEX_REC);
+       g_static_rec_mutex_init(&p->lock);
 }
 
 static void
@@ -789,7 +791,7 @@ camel_text_index_finalise(CamelTextIndex *idx)
        if (p->links)
                camel_object_unref((CamelObject *)p->links);
        
-       e_mutex_destroy(p->lock);
+       g_static_rec_mutex_free(&p->lock);
        
        g_free(p);
 }
index a624401..69c113b 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Fixes bug #356177
+
+       * camel-groupwise-folder.c:
+       * camel-groupwise-private.h:
+       * camel-groupwise-store.c:
+       Migrate from EMutex to GStaticMutex or GStaticRecMutex.
+
 2007-02-09  Sankar P  <psankar@novell.com>
 
        * camel-groupwise-folder.c: (gw_update_cache), (gw_update_summary):
index 44b63b0..82e165c 100644 (file)
@@ -69,8 +69,8 @@ static CamelOfflineFolderClass *parent_class = NULL;
 struct _CamelGroupwiseFolderPrivate {
 
 #ifdef ENABLE_THREADS
-       EMutex *search_lock;    /* for locking the search object */
-       EMutex *cache_lock;     /* for locking the cache object */
+       GStaticMutex search_lock;       /* for locking the search object */
+       GStaticRecMutex cache_lock;     /* for locking the cache object */
 #endif
 
 };
@@ -187,7 +187,7 @@ groupwise_folder_get_message( CamelFolder *folder, const char *uid, CamelExcepti
                goto end; /*Dont cache if its sent items, since we need to Track Status*/
 
        /* add to cache */
-       CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
        if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", uid, NULL))) {
                if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, cache_stream) == -1
                                || camel_stream_flush (cache_stream) == -1)
@@ -195,7 +195,7 @@ groupwise_folder_get_message( CamelFolder *folder, const char *uid, CamelExcepti
                camel_object_unref (cache_stream);
        }
 
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
 
 end:
        camel_message_info_free (&mi->info);
@@ -415,10 +415,10 @@ groupwise_folder_rename (CamelFolder *folder, const char *new)
 
        summary_path = g_strdup_printf ("%s/summary", folder_dir);
 
-       CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
        g_free (gw_folder->cache->path);
        gw_folder->cache->path = g_strdup (folder_dir);
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
 
        ((CamelFolderClass *)parent_class)->rename(folder, new);
        camel_folder_summary_set_filename (folder->summary, summary_path);
@@ -437,7 +437,7 @@ groupwise_folder_search_by_expression (CamelFolder *folder, const char *expressi
        CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER(folder);
        GPtrArray *matches;
 
-       CAMEL_GROUPWISE_FOLDER_LOCK(folder, search_lock);
+       CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
        camel_folder_search_set_folder (gw_folder->search, folder);
        matches = camel_folder_search_search(gw_folder->search, expression, NULL, ex);
        CAMEL_GROUPWISE_FOLDER_UNLOCK(gw_folder, search_lock);
@@ -454,7 +454,7 @@ groupwise_folder_search_by_uids(CamelFolder *folder, const char *expression, GPt
        if (uids->len == 0)
                return g_ptr_array_new();
 
-       CAMEL_GROUPWISE_FOLDER_LOCK(folder, search_lock);
+       CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
 
        camel_folder_search_set_folder(gw_folder->search, folder);
        matches = camel_folder_search_search(gw_folder->search, expression, uids, ex);
@@ -471,7 +471,7 @@ groupwise_folder_search_free (CamelFolder *folder, GPtrArray *uids)
 
        g_return_if_fail (gw_folder->search);
 
-       CAMEL_GROUPWISE_FOLDER_LOCK(folder, search_lock);
+       CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
 
        camel_folder_search_free_result (gw_folder->search, uids);
 
@@ -614,16 +614,16 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 
        container_id =  camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
 
-       CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
        if (!camel_groupwise_store_connected (gw_store, ex)) {
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                camel_exception_clear (ex);
                return;
        }
-       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 
        count = camel_folder_summary_count (folder->summary);
-       CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
        for (i=0 ; i < count ; i++) {
                guint32 flags = 0;
                info = camel_folder_summary_index (folder->summary, i);
@@ -679,7 +679,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
                                        }
 
                                        if (g_list_length (deleted_items) == GROUPWISE_BULK_DELETE_LIMIT ) {
-                                               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+                                               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
 
                                                /* 
                                                        Sync up the READ changes before deleting the message. 
@@ -700,15 +700,15 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 
                                                /* And now delete the messages */
                                                status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                                               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                                               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                                                if (status == E_GW_CONNECTION_STATUS_OK) {
                                                        char *uid;
                                                        while (deleted_items) {
                                                                uid = (char *)deleted_items->data;
-                                                               CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                                                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                                                                camel_folder_summary_remove_uid (folder->summary, uid);
                                                                camel_data_cache_remove(gw_folder->cache, "cache", uid, ex);
-                                                               CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                                                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                                                                deleted_items = g_list_next (deleted_items);
                                                                count -= GROUPWISE_BULK_DELETE_LIMIT;
                                                                i -= GROUPWISE_BULK_DELETE_LIMIT;
@@ -725,24 +725,24 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
                camel_message_info_free (info);
        }
        
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
 
        if (deleted_items) {
-               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
                if (!strcmp (folder->full_name, "Trash")) {
                        status = e_gw_connection_purge_selected_items (cnc, deleted_items);
                } else {
                        status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
                }
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                if (status == E_GW_CONNECTION_STATUS_OK) {
                        char *uid;
                        while (deleted_items) {
                                uid = (char *)deleted_items->data;
-                               CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                                camel_folder_summary_remove_uid (folder->summary, uid);
                                camel_data_cache_remove(gw_folder->cache, "cache", uid, ex);
-                               CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                                deleted_items = g_list_next (deleted_items);
                                count -= GROUPWISE_BULK_DELETE_LIMIT;
                                i -= GROUPWISE_BULK_DELETE_LIMIT;
@@ -752,31 +752,31 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
        }
 
        if (read_items) {
-               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
                e_gw_connection_mark_read (cnc, read_items);
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                g_list_free (read_items);
        }
 
        if (unread_items) {
-               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
                e_gw_connection_mark_unread (cnc, unread_items);
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                g_list_free (unread_items);
        }
 
        if (expunge) {
-               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
                status = e_gw_connection_purge_deleted_items (cnc);
                if (status == E_GW_CONNECTION_STATUS_OK) {
                        g_message ("Purged deleted items in %s", folder->name);
                }
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
        }
 
-       CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
        groupwise_sync_summary (folder, ex);
-       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 }
 
 CamelFolder *
@@ -1023,7 +1023,7 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
                gw_folder->need_refresh = TRUE;
        }
 
-       CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
 
        if (!camel_groupwise_store_connected (gw_store, ex)) 
                goto end1;
@@ -1130,7 +1130,7 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
        }
 
 
-       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
        is_locked = FALSE;
 
        /*
@@ -1162,7 +1162,7 @@ end2:
        g_free (container_id);
 end1:
        if (is_locked)
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
        return;
 }
 
@@ -1189,8 +1189,6 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
 
        gboolean is_proxy = folder->parent_store->flags & CAMEL_STORE_WRITE;
 
-       CAMEL_SERVICE_ASSERT_LOCKED (gw_store, connect_lock);
-
        changes = camel_folder_change_info_new ();
        container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name));
        if (!container_id) {
@@ -1393,7 +1391,7 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
                        if (mail_msg)
                                camel_medium_set_header (CAMEL_MEDIUM (mail_msg), "X-Evolution-Source", groupwise_base_url_lookup (priv));
 
-                       CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                        if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", id, NULL))) {
                                if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) mail_msg,  cache_stream) == -1 || camel_stream_flush (cache_stream) == -1)
                                        camel_data_cache_remove (gw_folder->cache, "cache", id, NULL);
@@ -1401,7 +1399,7 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
                        }
 
                        camel_object_unref (mail_msg);
-                       CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                }
                /******************** Caching stuff ends *************************/
                i++;
@@ -1911,11 +1909,11 @@ gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
                }
 
                if (!temp) {
-                       CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                        camel_folder_summary_remove_uid (folder->summary, info->uid);
                        camel_data_cache_remove (gw_folder->cache, "cache", info->uid, ex);
                        camel_folder_change_info_remove_uid (changes, info->uid);
-                       CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                } else { 
                        item_list = g_list_delete_link (item_list, temp);
                }
@@ -1927,9 +1925,9 @@ gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
        if (item_list) {
                CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE (folder->parent_store);
 
-               CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
                gw_update_cache (folder, item_list, ex, TRUE);  
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 
                g_list_foreach (item_list, (GFunc)g_free, NULL);        
                g_list_free (item_list);
@@ -1970,7 +1968,7 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
        }
        cnc = cnc_lookup (priv);
 
-       CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
        /*Get the container id*/
        container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
        
@@ -1994,7 +1992,7 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 
                if (appended_uid)
                        *appended_uid = NULL;
-               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                return;
        }
 
@@ -2007,14 +2005,14 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
                if (appended_uid)
                        *appended_uid = NULL;
 
-               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                return;
        }
 
        if (appended_uid)
                *appended_uid = g_strdup (id);  
        g_free (id);
-       CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
 }
 
 static int
@@ -2064,7 +2062,7 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
                source_container_id = NULL;
        dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination->full_name) ;
 
-       CAMEL_SERVICE_LOCK (source->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (source->parent_store, connect_lock);
        /* check for offline operation */
        if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
                CamelGroupwiseJournal *journal = (CamelGroupwiseJournal *) ((CamelGroupwiseFolder *) destination)->journal;
@@ -2091,7 +2089,7 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
                                camel_folder_delete_message(source, camel_message_info_uid (info));
                }
 
-               CAMEL_SERVICE_UNLOCK (source->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (source->parent_store, connect_lock);
                return;
        }
 
@@ -2128,9 +2126,9 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
                                        */
 
                                        wrapper = g_list_prepend (wrapper, (char *)uid);
-                                       CAMEL_SERVICE_LOCK (source->parent_store, connect_lock);
+                                       CAMEL_SERVICE_REC_LOCK (source->parent_store, connect_lock);
                                        e_gw_connection_mark_read (cnc, wrapper);
-                                       CAMEL_SERVICE_UNLOCK (source->parent_store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK (source->parent_store, connect_lock);
                                        g_list_free (wrapper);
                                        wrapper = NULL;
                                }
@@ -2144,9 +2142,9 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 
                                if (unset_flags.bits & CAMEL_MESSAGE_SEEN) {
                                        wrapper = g_list_prepend (wrapper, (char *)uid);
-                                       CAMEL_SERVICE_LOCK (source->parent_store, connect_lock);
+                                       CAMEL_SERVICE_REC_LOCK (source->parent_store, connect_lock);
                                        e_gw_connection_mark_unread (cnc, wrapper);
-                                       CAMEL_SERVICE_UNLOCK (source->parent_store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK (source->parent_store, connect_lock);
                                        g_list_free (wrapper);
                                        wrapper = NULL;
                                }
@@ -2177,7 +2175,7 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 
        gw_store->current_folder = source;
 
-       CAMEL_SERVICE_UNLOCK (source->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (source->parent_store, connect_lock);
 }
 
 static void
@@ -2203,7 +2201,7 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
                return;
 
        if (!strcmp (folder->full_name, "Trash")) {
-               CAMEL_SERVICE_LOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (groupwise_store, connect_lock);
                status = e_gw_connection_purge_deleted_items (cnc);
                if (status == E_GW_CONNECTION_STATUS_OK) {
                        camel_folder_freeze (folder);
@@ -2211,7 +2209,7 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
                        camel_folder_thaw (folder);
                } else
                        g_warning ("Could not Empty Trash\n");
-               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
                return;
        }
 
@@ -2234,18 +2232,18 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
                        }
                        if (g_list_length (deleted_items) == GROUPWISE_BULK_DELETE_LIMIT ) {
                                /* Read the FIXME below */
-                               CAMEL_SERVICE_LOCK (groupwise_store, connect_lock);
+                               CAMEL_SERVICE_REC_LOCK (groupwise_store, connect_lock);
                                status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
                                if (status == E_GW_CONNECTION_STATUS_OK) {
                                        char *uid;
                                        while (deleted_items) {
                                                uid = (char *)deleted_items->data;
-                                               CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                                                camel_folder_change_info_remove_uid (changes, uid);
                                                camel_folder_summary_remove_uid (folder->summary, uid);
                                                camel_data_cache_remove(gw_folder->cache, "cache", uid, ex);
-                                               CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                                                deleted_items = g_list_next (deleted_items);
                                                max -= GROUPWISE_BULK_DELETE_LIMIT;
                                                i -= GROUPWISE_BULK_DELETE_LIMIT;
@@ -2259,18 +2257,18 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
 
        if (deleted_items) {
                /* FIXME: Put these in a function and reuse it inside the above loop, here and in groupwise_sync*/
-               CAMEL_SERVICE_LOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (groupwise_store, connect_lock);
                status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
                if (status == E_GW_CONNECTION_STATUS_OK) {
                        char *uid;
                        while (deleted_items) {
                                uid = (char *)deleted_items->data;
-                               CAMEL_GROUPWISE_FOLDER_LOCK (folder, cache_lock);
+                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
                                camel_folder_change_info_remove_uid (changes, uid);
                                camel_folder_summary_remove_uid (folder->summary, uid);
                                camel_data_cache_remove(gw_folder->cache, "cache", uid, ex);
-                               CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
                                deleted_items = g_list_next (deleted_items);
                        }
                }
@@ -2321,9 +2319,10 @@ camel_groupwise_folder_init (gpointer object, gpointer klass)
        gw_folder->priv = g_malloc0 (sizeof(*gw_folder->priv));
 
 #ifdef ENABLE_THREADS
-       gw_folder->priv->search_lock = e_mutex_new(E_MUTEX_SIMPLE);
-       gw_folder->priv->cache_lock = e_mutex_new(E_MUTEX_REC);
+       g_static_mutex_init(&gw_folder->priv->search_lock);
+       g_static_rec_mutex_init(&gw_folder->priv->cache_lock);
 #endif 
+
        gw_folder->need_rescan = TRUE;
 }
 
index 000a11f..9898060 100644 (file)
@@ -35,16 +35,19 @@ extern "C" {
 #endif
 
 #ifdef ENABLE_THREADS
-#include "libedataserver/e-msgport.h"
-#endif
-
-
-#ifdef ENABLE_THREADS
-#define CAMEL_GROUPWISE_FOLDER_LOCK(f, l) (e_mutex_lock(((CamelGroupwiseFolder *)f)->priv->l))
-#define CAMEL_GROUPWISE_FOLDER_UNLOCK(f, l) (e_mutex_unlock(((CamelGroupwiseFolder *)f)->priv->l))
+#define CAMEL_GROUPWISE_FOLDER_LOCK(f, l) \
+       (g_static_mutex_lock(&((CamelGroupwiseFolder *)f)->priv->l))
+#define CAMEL_GROUPWISE_FOLDER_UNLOCK(f, l) \
+       (g_static_mutex_unlock(&((CamelGroupwiseFolder *)f)->priv->l))
+#define CAMEL_GROUPWISE_FOLDER_REC_LOCK(f, l) \
+       (g_static_rec_mutex_lock(&((CamelGroupwiseFolder *)f)->priv->l))
+#define CAMEL_GROUPWISE_FOLDER_REC_UNLOCK(f, l) \
+       (g_static_rec_mutex_unlock(&((CamelGroupwiseFolder *)f)->priv->l))
 #else
-#define CAMEL_GROUPWISE_FOLDER_LOCK(f, l)
-#define CAMEL_GROUPWISE_FOLDER_UNLOCK(f, l)
+#define GROUPWISE_FOLDER_LOCK(f, l)
+#define GROUPWISE_FOLDER_UNLOCK(f, l)
+#define GROUPWISE_FOLDER_REC_LOCK(f, l)
+#define GROUPWISE_FOLDER_REC_UNLOCK(f, l)
 #endif
 
 
index b9c39d0..82afdbc 100644 (file)
@@ -182,7 +182,6 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
        gboolean authenticated = FALSE;
        char *uri;
 
-       CAMEL_SERVICE_ASSERT_LOCKED (groupwise_store, connect_lock);
        if (priv->use_ssl && !g_str_equal (priv->use_ssl, "never")) 
                uri = g_strconcat ("https://", priv->server_name, ":", priv->port, "/soap", NULL);
        else 
@@ -286,15 +285,15 @@ groupwise_connect (CamelService *service, CamelException *ex)
                camel_service_construct (service, service->session, service->provider, service->url, ex);
        }
 
-       CAMEL_SERVICE_LOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (service, connect_lock);
        
        if (priv->cnc) {
-               CAMEL_SERVICE_UNLOCK (service, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
                return TRUE;
        }
 
        if (!check_for_connection (service, ex) || !groupwise_auth_loop (service, ex)) {
-               CAMEL_SERVICE_UNLOCK (service, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
                camel_service_disconnect (service, TRUE, NULL);
                return FALSE;
        }
@@ -321,7 +320,7 @@ groupwise_connect (CamelService *service, CamelException *ex)
 
        camel_store_summary_save ((CamelStoreSummary *) store->summary);
 
-       CAMEL_SERVICE_UNLOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
        if (E_IS_GW_CONNECTION (priv->cnc)) {
                return TRUE;
        }
@@ -389,12 +388,12 @@ groupwise_disconnect (CamelService *service, gboolean clean, CamelException *ex)
        CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
        
        if (clean) {
-               CAMEL_SERVICE_LOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (groupwise_store, connect_lock);
                if (groupwise_store->priv && groupwise_store->priv->cnc) {
                        g_object_unref (groupwise_store->priv->cnc);
                        groupwise_store->priv->cnc = NULL;
                }
-               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
        }
        
        //groupwise_disconnect_cleanup (service, clean, ex);
@@ -568,10 +567,10 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
 
        camel_exception_clear (ex);
 
-       CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
 
        if (!camel_groupwise_store_connected ((CamelGroupwiseStore *)store, ex)) {
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                return NULL;
        }
        
@@ -583,7 +582,7 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
        if (!E_IS_GW_CONNECTION( priv->cnc)) {
                if (!groupwise_connect (CAMEL_SERVICE(store), ex)) {
                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication failed"));
-                       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                        return NULL;
                }
        }
@@ -596,7 +595,7 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
        g_free(storage_path);
        folder = camel_gw_folder_new (store, folder_name, folder_dir, ex);
        if (!folder) {
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
                g_free (folder_dir);
                g_free (container_id);
@@ -621,7 +620,7 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
                                NULL,
                                &cursor);
                if (status != E_GW_CONNECTION_STATUS_OK) {
-                       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                        g_free (container_id);
                        return NULL;
                }
@@ -637,7 +636,7 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
                                all_ok = FALSE;
                                break;
                                /*
-                               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                                e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
                                //camel_folder_summary_clear (folder->summary);
                                camel_folder_summary_save (folder->summary);
@@ -678,7 +677,7 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
        camel_object_ref (folder);
 
        g_free (container_id);
-       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 
        return folder;
 }
@@ -699,17 +698,17 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
        
        camel_exception_clear (ex);
 
-       CAMEL_SERVICE_LOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
 
        if (!camel_groupwise_store_connected (gw_store, ex)) {
-               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                return;
        }
        
        if (!E_IS_GW_CONNECTION( priv->cnc)) {
                if (!groupwise_connect (CAMEL_SERVICE((CamelStore*)gw_store), ex)) {
                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication failed"));
-                       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                        return;
                }
        }
@@ -735,7 +734,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
                                NULL,
                                &cursor);
                if (status != E_GW_CONNECTION_STATUS_OK) {
-                       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                        g_free (container_id);
                        return;
                }
@@ -747,7 +746,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
                                                              cursor, FALSE, 
                                                              CURSOR_ITEM_LIMIT, position, &list);
                        if (status != E_GW_CONNECTION_STATUS_OK) {
-                               CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
                                e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
                                camel_folder_summary_save (folder->summary);
                                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
@@ -786,7 +785,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
        gw_store->current_folder = folder;
        
        g_free (container_id);
-       CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
        return;
 }
 
@@ -1077,7 +1076,7 @@ store_refresh_refresh (CamelSession *session, CamelSessionThreadMsg *msg)
        struct _store_refresh_msg *m = (struct _store_refresh_msg *)msg;
        CamelGroupwiseStore *groupwise_store = (CamelGroupwiseStore *)m->store;
        
-       CAMEL_SERVICE_LOCK (m->store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (m->store, connect_lock);
        if (!camel_groupwise_store_connected ((CamelGroupwiseStore *)m->store, &m->ex))
                goto done;
        /*Get the folder list and save it here*/
@@ -1086,7 +1085,7 @@ store_refresh_refresh (CamelSession *session, CamelSessionThreadMsg *msg)
                goto done;
        camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
 done:
-       CAMEL_SERVICE_UNLOCK (m->store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (m->store, connect_lock);
 }
 
 static void
@@ -1132,17 +1131,17 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca
         * is used as is here.
         */
        if (camel_store_summary_count ((CamelStoreSummary *)groupwise_store->summary) == 0) {
-               CAMEL_SERVICE_LOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (store, connect_lock);
                if (groupwise_store->list_loaded == 3) {
                        groupwise_folders_sync (groupwise_store, ex);
                        groupwise_store->list_loaded -= 1;
                }
                if (camel_exception_is_set (ex)) {
                        camel_store_summary_save ((CamelStoreSummary *) groupwise_store->summary);
-                       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                        return NULL;
                }
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
                goto end_r;
        }
@@ -1153,7 +1152,7 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca
                goto end_r;
        }
 
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        if ((groupwise_store->list_loaded == 1) && check_for_connection((CamelService *)store, ex)) {
                if (!priv->cnc) {
                        if (groupwise_connect ((CamelService *)store, ex)) {
@@ -1166,14 +1165,14 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca
                                CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS (groupwise_store->current_folder))->sync(groupwise_store->current_folder, FALSE, ex);
                        groupwise_folders_sync (groupwise_store, ex);
                        if (camel_exception_is_set (ex)) {
-                               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                                return NULL;
                        }
                        camel_store_summary_touch ((CamelStoreSummary *)groupwise_store->summary);
                        camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
                }
        }
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 
        /*camel_exception_clear (ex);*/
 end_r:
@@ -1196,7 +1195,7 @@ create_junk_folder (CamelStore *store)
        parent_id = "";
        /* TODO: check for offlining*/
                
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        status = e_gw_connection_modify_junk_settings (priv->cnc, JUNK_ENABLE, 0, 0,  JUNK_PERSISTENCE);
        if (status == E_GW_CONNECTION_STATUS_OK) {
                root = groupwise_build_folder_info(groupwise_store, parent_name, folder_name);
@@ -1211,7 +1210,7 @@ create_junk_folder (CamelStore *store)
                g_hash_table_insert (priv->parent_hash, g_strdup(child_container_id), g_strdup(parent_id));
                camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", root);
        }
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 
        return root;
 }
@@ -1256,7 +1255,7 @@ groupwise_create_folder(CamelStore *store,
                        return NULL;
                }
        }
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        status = e_gw_connection_create_folder(priv->cnc,parent_id,folder_name, &child_container_id);
        if (status == E_GW_CONNECTION_STATUS_OK) {
                root = groupwise_build_folder_info(groupwise_store, parent_name,folder_name);
@@ -1268,7 +1267,7 @@ groupwise_create_folder(CamelStore *store,
 
                camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", root);
        }
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        return root;
 }
 
@@ -1282,10 +1281,10 @@ groupwise_delete_folder(CamelStore *store,
        EGwConnectionStatus status;
        const char * container; 
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        if (!camel_groupwise_store_connected ((CamelGroupwiseStore *)store, ex)) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
 
@@ -1304,7 +1303,7 @@ groupwise_delete_folder(CamelStore *store,
                
                g_hash_table_remove (priv->parent_hash, container);
        }
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void 
@@ -1325,10 +1324,10 @@ groupwise_rename_folder(CamelStore *store,
                return;
        }
 
-       CAMEL_SERVICE_LOCK (groupwise_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (groupwise_store, connect_lock);
        
        if (!camel_groupwise_store_connected ((CamelGroupwiseStore *)store, ex)) {
-               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
                return;
        }
        
@@ -1343,7 +1342,7 @@ groupwise_rename_folder(CamelStore *store,
        {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename Groupwise folder `%s' to `%s'"),
                                      old_name, new_name);
-               CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
                return;
        }
 
@@ -1366,7 +1365,7 @@ groupwise_rename_folder(CamelStore *store,
 
        g_free (oldpath);
        g_free (newpath);
-       CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
 }
 
 char * 
index d5d78d1..f9349b8 100644 (file)
@@ -1,3 +1,13 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Fixes bug #356177
+
+       * camel-imap-command.c:
+       * camel-imap-folder.c:
+       * camel-imap-private.h:
+       * camel-imap-store.c:
+       Migrate from EMutex to GStaticMutex or GStaticRecMutex.
+
 2007-01-30  Sankar P  <psankar@novell.com>
 
        * camel-imap-folder.c: (imap_update_summary):
index 9efabd4..99086b4 100644 (file)
@@ -92,7 +92,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
        va_list ap;
        char *cmd;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        if (fmt) {
                va_start (ap, fmt);
@@ -108,7 +108,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
        
        if (!imap_command_start (store, folder, cmd, ex)) {
                g_free (cmd);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return NULL;
        }
        g_free (cmd);
@@ -162,12 +162,12 @@ camel_imap_command_start (CamelImapStore *store, CamelFolder *folder,
        cmd = imap_command_strdup_vprintf (store, fmt, ap);
        va_end (ap);
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        ok = imap_command_start (store, folder, cmd, ex);
        g_free (cmd);
        
        if (!ok)
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        return ok;
 }
 
@@ -266,7 +266,7 @@ camel_imap_command_continuation (CamelImapStore *store, const char *cmd,
                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
                                             g_strerror (errno));
                camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return NULL;
        }
        
@@ -296,7 +296,7 @@ camel_imap_command_response (CamelImapStore *store, char **response,
        char *respbuf;
        
        if (camel_imap_store_readline (store, &respbuf, ex) < 0) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return CAMEL_IMAP_RESPONSE_ERROR;
        }
        
@@ -345,7 +345,7 @@ camel_imap_command_response (CamelImapStore *store, char **response,
        
        if (type == CAMEL_IMAP_RESPONSE_ERROR ||
            type == CAMEL_IMAP_RESPONSE_TAGGED)
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        return type;
 }
@@ -362,7 +362,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
         * we're still locked. This lock is owned by response
         * and gets unlocked when response is freed.
         */
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        response = g_new0 (CamelImapResponse, 1);
        if (store->current_folder && camel_disco_store_status (CAMEL_DISCO_STORE (store)) != CAMEL_DISCO_STORE_RESYNCING) {
@@ -620,7 +620,7 @@ camel_imap_response_free (CamelImapStore *store, CamelImapResponse *response)
        }
        
        g_free (response);
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 /**
index 56c869e..ab060d0 100644 (file)
@@ -191,8 +191,8 @@ camel_imap_folder_init (gpointer object, gpointer klass)
        
        imap_folder->priv = g_malloc0(sizeof(*imap_folder->priv));
 #ifdef ENABLE_THREADS
-       imap_folder->priv->search_lock = e_mutex_new(E_MUTEX_SIMPLE);
-       imap_folder->priv->cache_lock = e_mutex_new(E_MUTEX_REC);
+       g_static_mutex_init(&imap_folder->priv->search_lock);
+       g_static_rec_mutex_init(&imap_folder->priv->cache_lock);
 #endif
 
        imap_folder->need_rescan = TRUE;
@@ -296,8 +296,6 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
        int i, count;
        char *resp;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (folder->parent_store, connect_lock);
-       
        count = camel_folder_summary_count (folder->summary);
        
        for (i = 0; i < response->untagged->len; i++) {
@@ -347,9 +345,9 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
        else if (validity != imap_summary->validity) {
                imap_summary->validity = validity;
                camel_folder_summary_clear (folder->summary);
-               CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
                camel_imap_message_cache_clear (imap_folder->cache);
-               CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
                imap_folder->need_rescan = FALSE;
                camel_imap_folder_changed (folder, exists, NULL, ex);
                return;
@@ -425,8 +423,8 @@ imap_finalize (CamelObject *object)
                camel_object_unref (CAMEL_OBJECT (imap_folder->cache));
 
 #ifdef ENABLE_THREADS
-       e_mutex_destroy(imap_folder->priv->search_lock);
-       e_mutex_destroy(imap_folder->priv->cache_lock);
+       g_static_mutex_free(&imap_folder->priv->search_lock);
+       g_static_rec_mutex_free(&imap_folder->priv->cache_lock);
 #endif
        g_free(imap_folder->priv);
 }
@@ -481,9 +479,9 @@ imap_rename (CamelFolder *folder, const char *new)
        g_free (folders);
        summary_path = g_strdup_printf("%s/summary", folder_dir);
 
-       CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (folder, cache_lock);
        camel_imap_message_cache_set_path(imap_folder->cache, folder_dir);
-       CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (folder, cache_lock);
 
        camel_folder_summary_set_filename(folder->summary, summary_path);
 
@@ -518,7 +516,7 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
         * Also, if this is the INBOX, some servers (cryus) wont tell
         * us with a NOOP of new messages, so force a reselect which
         * should do it.  */
-       CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
 
        if (!camel_imap_store_connected(imap_store, ex))
                goto done;
@@ -563,7 +561,7 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
                camel_store_summary_info_free((CamelStoreSummary *)((CamelImapStore *)folder->parent_store)->summary, si);
        }
 done:
-       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
 
        camel_folder_summary_save(folder->summary);
        camel_store_summary_save((CamelStoreSummary *)((CamelImapStore *)folder->parent_store)->summary);
@@ -620,7 +618,6 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
        gboolean ok;
        CamelFolderChangeInfo *changes = NULL;
 
-       CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
        imap_folder->need_rescan = FALSE;
        
        summary_len = camel_folder_summary_count (folder->summary);
@@ -834,7 +831,7 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
        }
        
        camel_exception_init (&local_ex);
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        /* Find a message with changed flags, find all of the other
         * messages like it, sync them as a group, mark them as
@@ -902,7 +899,7 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
                g_ptr_array_free (matches, TRUE);
                
                /* We unlock here so that other threads can have a chance to grab the connect_lock */
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                
                /* check for an exception */
                if (camel_exception_is_set (&local_ex)) {
@@ -911,13 +908,13 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
                }
                
                /* Re-lock the connect_lock */
-               CAMEL_SERVICE_LOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        }
        
        /* Save the summary */
        imap_sync_offline (folder, ex);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static int
@@ -970,12 +967,12 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
        int uid = 0;
        char *set;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
 
        if ((store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0) {
                ((CamelFolderClass *)CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, 0, ex);
                if (camel_exception_is_set(ex)) {
-                       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                        return;
                }
        }
@@ -990,7 +987,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
                if (response)
                        camel_imap_response_free (store, response);
                if (camel_exception_is_set (ex)) {
-                       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                        g_free (set);
                        return;
                }
@@ -1005,7 +1002,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
                        camel_imap_response_free (store, response);
        }
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1031,22 +1028,22 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
         * marked un-deleted.
         */
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
 
        ((CamelFolderClass *)CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, 0, ex);
        if (camel_exception_is_set(ex)) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
 
        response = camel_imap_command (store, folder, ex, "UID SEARCH DELETED");
        if (!response) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        result = camel_imap_response_extract (store, response, "SEARCH", ex);
        if (!result) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        
@@ -1107,7 +1104,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
                        if (!response) {
                                g_ptr_array_free (keep_uids, TRUE);
                                g_ptr_array_free (mark_uids, TRUE);
-                               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                                return;
                        }
                        camel_imap_response_free (store, response);
@@ -1131,7 +1128,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
                        if (!response) {
                                g_ptr_array_free (keep_uids, TRUE);
                                g_ptr_array_free (mark_uids, TRUE);
-                               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                                return;
                        }
                        camel_imap_response_free (store, response);
@@ -1171,7 +1168,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
        /* now we can free this, now that we're done with keep_uids */
        g_free (result);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static gchar *
@@ -1204,10 +1201,10 @@ imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
        uid = get_temp_uid ();
 
        camel_imap_summary_add_offline (folder->summary, uid, message, info);
-       CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (folder, cache_lock);
        camel_imap_message_cache_insert_wrapper (cache, uid, "",
                                                 CAMEL_DATA_WRAPPER (message), ex);
-       CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (folder, cache_lock);
 
        changes = camel_folder_change_info_new ();
        camel_folder_change_info_add_uid (changes, uid);
@@ -1337,11 +1334,11 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
                /* Cache first, since freeing response may trigger a
                 * summary update that will want this information.
                 */
-               CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_LOCK (folder, cache_lock);
                camel_imap_message_cache_insert_wrapper (
                        CAMEL_IMAP_FOLDER (folder)->cache, uid,
                        "", CAMEL_DATA_WRAPPER (message), ex);
-               CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (folder, cache_lock);
                if (appended_uid)
                        *appended_uid = uid;
                else
@@ -1352,11 +1349,11 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
        camel_imap_response_free (store, response);
        
        /* Make sure a "folder_changed" is emitted. */
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        if (store->current_folder != folder ||
            camel_folder_summary_count (folder->summary) == count)
                imap_refresh_info (folder, ex);
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1376,10 +1373,10 @@ imap_append_resyncing (CamelFolder *folder, CamelMimeMessage *message,
                CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
                const char *olduid = camel_message_info_uid (info);
                
-               CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
                camel_imap_message_cache_copy (imap_folder->cache, olduid,
                                               imap_folder->cache, uid, ex);
-               CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 
                if (appended_uid)
                        *appended_uid = uid;
@@ -1411,10 +1408,10 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
         * deadlock in the case where we're simultaneously also trying
         * to copy messages in the other direction from another thread.
         */
-       CAMEL_SERVICE_LOCK (store, connect_lock);
-       CAMEL_IMAP_FOLDER_LOCK (source, cache_lock);
-       CAMEL_IMAP_FOLDER_LOCK (dest, cache_lock);
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (source, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (dest, cache_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 
        if (transferred_uids) {
                *transferred_uids = g_ptr_array_new ();
@@ -1452,8 +1449,8 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
                        camel_folder_delete_message (source, uid);
        }
 
-       CAMEL_IMAP_FOLDER_UNLOCK (dest, cache_lock);
-       CAMEL_IMAP_FOLDER_UNLOCK (source, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (dest, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (source, cache_lock);
 
        camel_object_trigger_event (CAMEL_OBJECT (dest), "folder_changed", changes);
        camel_folder_change_info_free (changes);
@@ -1496,15 +1493,15 @@ handle_copyuid (CamelImapResponse *response, CamelFolder *source,
                 * cache locks here, because we've got the store's
                 * command lock too, so no one else could be here.
                 */
-               CAMEL_IMAP_FOLDER_LOCK (source, cache_lock);
-               CAMEL_IMAP_FOLDER_LOCK (destination, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_LOCK (source, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_LOCK (destination, cache_lock);
                for (i = 0; i < src->len; i++) {
                        camel_imap_message_cache_copy (scache, src->pdata[i],
                                                       dcache, dest->pdata[i],
                                                       NULL);
                }
-               CAMEL_IMAP_FOLDER_UNLOCK (source, cache_lock);
-               CAMEL_IMAP_FOLDER_UNLOCK (destination, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (source, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (destination, cache_lock);
 
                imap_uid_array_free (src);
                imap_uid_array_free (dest);
@@ -2095,16 +2092,16 @@ imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
                                char *body, *found_uid;
                                int i;
                                
-                               CAMEL_SERVICE_LOCK(store, connect_lock);
+                               CAMEL_SERVICE_REC_LOCK(store, connect_lock);
                                if (!camel_imap_store_connected(store, ex)) {
-                                       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
                                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
                                                             _("This message is not currently available"));
                                        goto fail;
                                }
                                
                                response = camel_imap_command (store, folder, ex, "UID FETCH %s BODY", uid);
-                               CAMEL_SERVICE_UNLOCK(store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
 
                                if (response) {
                                        for (i = 0, body = NULL; i < response->untagged->len; i++) {
@@ -2346,7 +2343,6 @@ imap_update_summary (CamelFolder *folder, int exists,
        char *uid, *resp;
        GData *data;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
        if (store->server_level >= IMAP_LEVEL_IMAP4REV1) {
                if (store->headers == IMAP_FETCH_ALL_HEADERS)
                        header_spec = g_string_new ("HEADER");
@@ -2642,8 +2638,6 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
        CamelMessageInfo *info;
        int len;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (folder->parent_store, connect_lock);
-       
        changes = camel_folder_change_info_new ();
        if (expunged) {
                int i, id;
@@ -2658,9 +2652,9 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
                        }
                        
                        camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
-                       CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+                       CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
                        camel_imap_message_cache_remove (imap_folder->cache, camel_message_info_uid (info));
-                       CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+                       CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
                        camel_folder_summary_remove (folder->summary, info);
                        camel_message_info_free(info);
                }
@@ -2717,27 +2711,27 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
         * getting the same data from the cache, but that is only
         * an inefficiency, and bad luck.
         */
-       CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
        stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex);
        if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0"))) {
                camel_exception_clear (ex);
                stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex);
        }
-       CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
        
        if (stream || cache_only)
                return stream;
 
        camel_exception_clear(ex);
 
-       CAMEL_SERVICE_LOCK (store, connect_lock);
-       CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
+       CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 
        if (!camel_imap_store_connected(store, ex)) {
                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
                                     _("This message is not currently available"));
-               CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return NULL;
        }
        
@@ -2752,10 +2746,10 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
                                               uid, section_text);
        }
        /* We won't need the connect_lock again after this. */
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        if (!response) {
-               CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+               CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
                return NULL;
        }
        
@@ -2770,7 +2764,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
                stream = NULL;
        }
        camel_imap_response_free (store, response);
-       CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+       CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
        if (!stream) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
                                      _("Could not find message body in FETCH response."));
@@ -2908,11 +2902,11 @@ parse_fetch_response (CamelImapFolder *imap_folder, char *response)
                if (header && !cache_header) {
                        stream = camel_stream_mem_new_with_buffer (body, body_len);
                } else {
-                       CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
+                       CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
                        stream = camel_imap_message_cache_insert (imap_folder->cache,
                                                                  uid, part_spec,
                                                                  body, body_len, NULL);
-                       CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+                       CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
                        if (stream == NULL)
                                stream = camel_stream_mem_new_with_buffer (body, body_len);
                }
index fdf1900..bfd3474 100644 (file)
@@ -13,23 +13,27 @@ extern "C" {
 #include <config.h>
 #endif
 
-#ifdef ENABLE_THREADS
-#include "libedataserver/e-msgport.h"
-#endif
-
 struct _CamelImapFolderPrivate {
 #ifdef ENABLE_THREADS
-       EMutex *search_lock;    /* for locking the search object */
-       EMutex *cache_lock;     /* for locking the cache object */
+       GStaticMutex search_lock;       /* for locking the search object */
+       GStaticRecMutex cache_lock;     /* for locking the cache object */
 #endif
 };
 
 #ifdef ENABLE_THREADS
-#define CAMEL_IMAP_FOLDER_LOCK(f, l) (e_mutex_lock(((CamelImapFolder *)f)->priv->l))
-#define CAMEL_IMAP_FOLDER_UNLOCK(f, l) (e_mutex_unlock(((CamelImapFolder *)f)->priv->l))
+#define CAMEL_IMAP_FOLDER_LOCK(f, l) \
+       (g_static_mutex_lock(&((CamelImapFolder *)f)->priv->l))
+#define CAMEL_IMAP_FOLDER_UNLOCK(f, l) \
+       (g_static_mutex_unlock(&((CamelImapFolder *)f)->priv->l))
+#define CAMEL_IMAP_FOLDER_REC_LOCK(f, l) \
+       (g_static_rec_mutex_lock(&((CamelImapFolder *)f)->priv->l))
+#define CAMEL_IMAP_FOLDER_REC_UNLOCK(f, l) \
+       (g_static_rec_mutex_unlock(&((CamelImapFolder *)f)->priv->l))
 #else
-#define CAMEL_IMAP_FOLDER_LOCK(f, l)
-#define CAMEL_IMAP_FOLDER_UNLOCK(f, l)
+#define CAMEL_IMAP_FOLDER_LOCK(obj)
+#define CAMEL_IMAP_FOLDER_UNLOCK(obj)
+#define CAMEL_IMAP_FOLDER_REC_LOCK(obj)
+#define CAMEL_IMAP_FOLDER_REC_UNLOCK(obj)
 #endif
 
 struct _CamelImapWrapperPrivate {
index fe2070c..d7cc0fb 100644 (file)
@@ -520,8 +520,6 @@ imap_get_capability (CamelService *service, CamelException *ex)
        CamelImapResponse *response;
        char *result;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
-       
        /* Find out the IMAP capabilities */
        /* We assume we have utf8 capable search until a failed search tells us otherwise */
        store->capabilities = IMAP_CAPABILITY_utf8_search;
@@ -1022,11 +1020,11 @@ query_auth_types (CamelService *service, CamelException *ex)
        if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex))
                return NULL;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        connected = store->istream != NULL && store->connected;
        if (!connected)
                connected = connect_to_server_wrapper (service, ex);
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        if (!connected)
                return NULL;
        
@@ -1254,8 +1252,6 @@ try_auth (CamelImapStore *store, const char *mech, CamelException *ex)
        char *resp;
        char *sasl_resp;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
-       
        response = camel_imap_command (store, NULL, ex, "AUTHENTICATE %s", mech);
        if (!response)
                return FALSE;
@@ -1318,7 +1314,6 @@ imap_auth_loop (CamelService *service, CamelException *ex)
        gboolean authenticated = FALSE;
        const char *auth_domain;
        
-       CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
        auth_domain = camel_url_get_param (service->url, "auth-domain");
        
        if (store->preauthed) {
@@ -1435,10 +1430,10 @@ imap_connect_online (CamelService *service, CamelException *ex)
        size_t len;
        CamelImapStoreNamespace *ns;
 
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        if (!connect_to_server_wrapper (service, ex) ||
            !imap_auth_loop (service, ex)) {
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                camel_service_disconnect (service, TRUE, NULL);
                return FALSE;
        }
@@ -1559,7 +1554,7 @@ imap_connect_online (CamelService *service, CamelException *ex)
        /* save any changes we had */
        camel_store_summary_save((CamelStoreSummary *)store->summary);
 
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        if (camel_exception_is_set (ex))
                camel_service_disconnect (service, TRUE, NULL);
@@ -1661,7 +1656,7 @@ imap_noop (CamelStore *store, CamelException *ex)
        CamelImapResponse *response;
        CamelFolder *current_folder;
        
-       CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
 
        if (!camel_imap_store_connected(imap_store, ex))
                goto done;
@@ -1676,7 +1671,7 @@ imap_noop (CamelStore *store, CamelException *ex)
                        camel_imap_response_free (imap_store, response);
        }
 done:
-       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
 }
 
 static CamelFolder *
@@ -1858,10 +1853,10 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                return new_folder;
        camel_exception_clear(ex);
 
-       CAMEL_SERVICE_LOCK(imap_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(imap_store, connect_lock);
 
        if (!camel_imap_store_connected(imap_store, ex)) {
-               CAMEL_SERVICE_UNLOCK(imap_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                return NULL;
        }
        
@@ -1878,14 +1873,14 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                const char *c;
                
                if (camel_exception_get_id(ex) == CAMEL_EXCEPTION_USER_CANCEL) {
-                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                        return NULL;
                }
                
                camel_exception_clear (ex);
                
                if (!(flags & CAMEL_STORE_FOLDER_CREATE)) {
-                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                        camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
                                              _("No such folder %s"), folder_name);
                        return NULL;
@@ -1897,7 +1892,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                        c++;
                
                if (*c != '\0') {
-                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                        camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
                                              _("The folder name \"%s\" is invalid because it contains the character \"%c\""),
                                              folder_name, *c);
@@ -1918,7 +1913,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                        int i;
                        
                        if (!(response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %G", parent_real))) {
-                               CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                                g_free (parent_name);
                                g_free (parent_real);
                                return NULL;
@@ -1963,7 +1958,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                                if (messages > 0) {
                                        camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
                                                             _("The parent folder is not allowed to contain subfolders"));
-                                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                                        g_free (parent_name);
                                        g_free (parent_real);
                                        return NULL;
@@ -1973,7 +1968,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                                camel_exception_init (&lex);
                                delete_folder (store, parent_name, &lex);
                                if (camel_exception_is_set (&lex)) {
-                                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                                        camel_exception_xfer (ex, &lex);
                                        g_free (parent_name);
                                        g_free (parent_real);
@@ -1987,7 +1982,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                                g_free (name);
                                
                                if (!response) {
-                                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                                        g_free (parent_name);
                                        g_free (parent_real);
                                        return NULL;
@@ -2011,7 +2006,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                }
                g_free(folder_real);
                if (!response) {
-                       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                        return NULL;
                }
        } else if (flags & CAMEL_STORE_FOLDER_EXCL) {
@@ -2021,7 +2016,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                
                camel_imap_response_free_without_processing (imap_store, response);
                
-               CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
                
                return NULL;
        }
@@ -2049,7 +2044,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
        }
        camel_imap_response_free_without_processing (imap_store, response);
        
-       CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
        
        return new_folder;
 }
@@ -2090,7 +2085,7 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
        CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
        CamelImapResponse *response;
 
-       CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
 
        if (!camel_imap_store_connected(imap_store, ex))
                goto fail;
@@ -2112,7 +2107,7 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
                imap_forget_folder (imap_store, folder_name, ex);
        }
 fail:
-       CAMEL_SERVICE_UNLOCK(imap_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(imap_store, connect_lock);
 }
 
 static void
@@ -2190,7 +2185,7 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name_in,
        CamelImapResponse *response;
        char *oldpath, *newpath, *storage_path;
 
-       CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
 
        if (!camel_imap_store_connected(imap_store, ex))
                goto fail;
@@ -2242,7 +2237,7 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name_in,
        g_free (newpath);
 fail:
        imap_store->renaming = FALSE;
-       CAMEL_SERVICE_UNLOCK(imap_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(imap_store, connect_lock);
 }
 
 static CamelFolderInfo *
@@ -2631,7 +2626,7 @@ refresh_refresh(CamelSession *session, CamelSessionThreadMsg *msg)
        struct _refresh_msg *m = (struct _refresh_msg *)msg;
        CamelImapStore *store = (CamelImapStore *)m->store;
 
-       CAMEL_SERVICE_LOCK(m->store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(m->store, connect_lock);
 
        if (!camel_imap_store_connected((CamelImapStore *)m->store, &m->ex))
                goto done;
@@ -2653,7 +2648,7 @@ refresh_refresh(CamelSession *session, CamelSessionThreadMsg *msg)
        }
        camel_store_summary_save((CamelStoreSummary *)((CamelImapStore *)m->store)->summary);
 done:
-       CAMEL_SERVICE_UNLOCK(m->store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(m->store, connect_lock);
 }
 
 static void
@@ -2694,7 +2689,7 @@ get_folder_info_online (CamelStore *store, const char *top, guint32 flags, Camel
                now = time(0);
                ref = now > imap_store->refresh_stamp+60*60*1;
                if (ref) {
-                       CAMEL_SERVICE_LOCK(store, connect_lock);
+                       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
                        ref = now > imap_store->refresh_stamp+60*60*1;
                        if (ref) {
                                struct _refresh_msg *m;
@@ -2707,13 +2702,13 @@ get_folder_info_online (CamelStore *store, const char *top, guint32 flags, Camel
                                camel_exception_init(&m->ex);
                                camel_session_thread_queue(((CamelService *)store)->session, &m->msg, 0);
                        }
-                       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
                }
        } else {
                char *pattern;
                int i;
 
-               CAMEL_SERVICE_LOCK(store, connect_lock);
+               CAMEL_SERVICE_REC_LOCK(store, connect_lock);
 
                if (!camel_imap_store_connected((CamelImapStore *)store, ex))
                        goto fail;
@@ -2759,14 +2754,14 @@ get_folder_info_online (CamelStore *store, const char *top, guint32 flags, Camel
                        get_folders_sync(imap_store, pattern, ex);
                }
                camel_store_summary_save((CamelStoreSummary *)imap_store->summary);
-               CAMEL_SERVICE_UNLOCK(store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
        }
 
        tree = get_folder_info_offline(store, top, flags, ex);
        return tree;
 
 fail:
-       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
        return NULL;
 }
 
@@ -2889,7 +2884,7 @@ subscribe_folder (CamelStore *store, const char *folder_name,
        CamelFolderInfo *fi;
        CamelStoreInfo *si;
 
-       CAMEL_SERVICE_LOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
 
        if (!camel_imap_store_connected (imap_store, ex))
                goto done;
@@ -2923,7 +2918,7 @@ subscribe_folder (CamelStore *store, const char *folder_name,
        camel_object_trigger_event (CAMEL_OBJECT (store), "folder_subscribed", fi);
        camel_folder_info_free (fi);
 done:
-       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
 }
 
 static void
@@ -2933,7 +2928,7 @@ unsubscribe_folder (CamelStore *store, const char *folder_name,
        CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
        CamelImapResponse *response;
 
-       CAMEL_SERVICE_LOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
        
        if (!camel_imap_store_connected (imap_store, ex))
                goto done;
@@ -2946,7 +2941,7 @@ unsubscribe_folder (CamelStore *store, const char *folder_name,
 
        imap_folder_effectively_unsubscribed (imap_store, folder_name, ex);
 done:
-       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
 }
 
 #if 0
index 16a2793..8d1c1f1 100644 (file)
@@ -1,3 +1,11 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Fixes bug #356177
+
+       * camel-imap4-folder.c:
+       * camel-imap4-store.c:
+       Migrate from EMutex to GStaticMutex or GStaticRecMutex.
+
 2006-07-12  Andre Klapper  <a9016009@gmx.de>
 
        * camel-imap4-provider.c:
index 428ea1e..20966fc 100644 (file)
@@ -552,7 +552,7 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
        if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return;
        
-       CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
        
        /* gather a list of changes to sync to the server */
        if (folder->permanent_flags) {
@@ -620,7 +620,7 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
 }
 
 static void
@@ -641,7 +641,7 @@ imap4_refresh_info (CamelFolder *folder, CamelException *ex)
        if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return;
        
-       CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
        
        if (folder != selected) {
                if (camel_imap4_engine_select_folder (engine, folder, ex) == -1)
@@ -666,7 +666,7 @@ imap4_refresh_info (CamelFolder *folder, CamelException *ex)
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
 }
 
 static int
@@ -777,14 +777,14 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
        CamelIMAP4Command *ic;
        int id;
        
-       CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
        
        if (imap4_folder->cache && (stream = camel_data_cache_get (imap4_folder->cache, "cache", uid, ex))) {
                message = camel_mime_message_new ();
                
                if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
                        if (errno == EINTR) {
-                               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+                               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                                camel_exception_setv (ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
                                camel_object_unref (message);
                                camel_object_unref (stream);
@@ -801,12 +801,12 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
        }
        
        if (message != NULL) {
-               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                return message;
        }
        
        if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
                                     _("This message is not available in offline mode."));
                return NULL;
@@ -878,7 +878,7 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
        
        return message;
 }
@@ -921,7 +921,7 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message,
                return;
        }
        
-       CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
        
        /* construct the option flags list */
        if (iinfo->info.flags & folder->permanent_flags) {
@@ -983,7 +983,7 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message,
        if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
                camel_exception_xfer (ex, &ic->ex);
                camel_imap4_command_unref (ic);
-               CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
                return;
        }
        
@@ -1044,7 +1044,7 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message,
        
        camel_imap4_command_unref (ic);
        
-       CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
 }
 
 
@@ -1100,7 +1100,7 @@ imap4_transfer_messages_to (CamelFolder *src, GPtrArray *uids, CamelFolder *dest
        
        g_ptr_array_sort (infos, (GCompareFunc) info_uid_sort);
        
-       CAMEL_SERVICE_LOCK (src->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (src->parent_store, connect_lock);
        
        /* check for offline operation */
        if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
@@ -1196,7 +1196,7 @@ imap4_transfer_messages_to (CamelFolder *src, GPtrArray *uids, CamelFolder *dest
                camel_message_info_free (infos->pdata[i]);
        g_ptr_array_free (infos, TRUE);
        
-       CAMEL_SERVICE_UNLOCK (src->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (src->parent_store, connect_lock);
 }
 
 static GPtrArray *
@@ -1205,12 +1205,12 @@ imap4_search_by_expression (CamelFolder *folder, const char *expr, CamelExceptio
        CamelIMAP4Folder *imap4_folder = (CamelIMAP4Folder *) folder;
        GPtrArray *matches;
        
-       CAMEL_SERVICE_LOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
        
        camel_folder_search_set_folder (imap4_folder->search, folder);
        matches = camel_folder_search_search (imap4_folder->search, expr, NULL, ex);
        
-       CAMEL_SERVICE_UNLOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
        
        return matches;
 }
@@ -1224,12 +1224,12 @@ imap4_search_by_uids (CamelFolder *folder, const char *expr, GPtrArray *uids, Ca
        if (uids->len == 0)
                return g_ptr_array_new ();
        
-       CAMEL_SERVICE_LOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
        
        camel_folder_search_set_folder (imap4_folder->search, folder);
        matches = camel_folder_search_search (imap4_folder->search, expr, uids, ex);
        
-       CAMEL_SERVICE_UNLOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
        
        return matches;
 }
@@ -1241,9 +1241,9 @@ imap4_search_free (CamelFolder *folder, GPtrArray *uids)
        
        g_return_if_fail (imap4_folder->search);
        
-       CAMEL_SERVICE_LOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
        
        camel_folder_search_free_result (imap4_folder->search, uids);
        
-       CAMEL_SERVICE_UNLOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
 }
index ab948c9..6dc42ae 100644 (file)
@@ -559,12 +559,12 @@ imap4_connect (CamelService *service, CamelException *ex)
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return TRUE;
        
-       CAMEL_SERVICE_LOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (service, connect_lock);
        if (store->engine->state == CAMEL_IMAP4_ENGINE_DISCONNECTED)
                retval = imap4_reconnect (store->engine, ex);
        else
                retval = TRUE;
-       CAMEL_SERVICE_UNLOCK (service, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
        
        return retval;
 }
@@ -579,7 +579,7 @@ imap4_disconnect (CamelService *service, gboolean clean, CamelException *ex)
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return TRUE;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        if (clean && store->engine->state != CAMEL_IMAP4_ENGINE_DISCONNECTED) {
                ic = camel_imap4_engine_queue (store->engine, NULL, "LOGOUT\r\n");
                while ((id = camel_imap4_engine_iterate (store->engine)) < ic->id && id != -1)
@@ -587,7 +587,7 @@ imap4_disconnect (CamelService *service, gboolean clean, CamelException *ex)
                
                camel_imap4_command_unref (ic);
        }
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        return 0;
 }
@@ -605,9 +605,9 @@ imap4_query_auth_types (CamelService *service, CamelException *ex)
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return NULL;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        connected = connect_to_server_wrapper (store->engine, ex);
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        if (!connected)
                return NULL;
        
@@ -678,7 +678,7 @@ imap4_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Cam
        int create;
        int id, i;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
                if ((flags & CAMEL_STORE_FOLDER_CREATE) != 0) {
@@ -687,7 +687,7 @@ imap4_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Cam
                        folder = camel_imap4_folder_new (store, folder_name, ex);
                }
                
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                
                return folder;
        }
@@ -757,7 +757,7 @@ imap4_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Cam
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        return folder;
 }
@@ -774,7 +774,7 @@ imap4_folder_can_contain_folders (CamelStore *store, const char *folder_name, Ca
        char *utf7_name;
        int id, i;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
        
@@ -826,7 +826,7 @@ imap4_folder_can_contain_folders (CamelStore *store, const char *folder_name, Ca
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        g_ptr_array_free (array, TRUE);
        g_free (utf7_name);
@@ -845,7 +845,7 @@ imap4_folder_create (CamelStore *store, const char *folder_name, const char *sub
        const char *c;
        int id;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
        ic = camel_imap4_engine_queue (engine, NULL, "CREATE %S%s\r\n", utf7_name, subfolder_hint);
@@ -899,7 +899,7 @@ imap4_folder_create (CamelStore *store, const char *folder_name, const char *sub
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        return fi;
 }
@@ -1005,7 +1005,7 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
                return;
        }
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        if (selected && !strcmp (folder_name, selected->full_name))
                ic0 = camel_imap4_engine_queue (engine, NULL, "CLOSE\r\n");
@@ -1027,7 +1027,7 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
                        camel_imap4_command_unref (ic0);
                
                camel_imap4_command_unref (ic);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        
@@ -1072,7 +1072,7 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
        
        camel_imap4_command_unref (ic);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1096,7 +1096,7 @@ imap4_rename_folder (CamelStore *store, const char *old_name, const char *new_na
                return;
        }
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        old_uname = imap4_folder_utf7_name (store, old_name, '\0');
        new_uname = imap4_folder_utf7_name (store, new_name, '\0');
@@ -1111,7 +1111,7 @@ imap4_rename_folder (CamelStore *store, const char *old_name, const char *new_na
        if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
                camel_exception_xfer (ex, &ic->ex);
                camel_imap4_command_unref (ic);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        
@@ -1135,7 +1135,7 @@ imap4_rename_folder (CamelStore *store, const char *old_name, const char *new_na
        
        camel_imap4_command_unref (ic);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static int
@@ -1353,7 +1353,7 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
        else
                base = top;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
 #ifdef USE_FOLDER_INFO_CACHE_LOGIC_FOR_SPEED
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL
@@ -1374,7 +1374,7 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
                         * and query the server. */
                        goto check_online;
                }
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return fi;
        }
 #else
@@ -1391,7 +1391,7 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
                                fi = inbox;
                        }
                }
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return fi;
        }
 #endif
@@ -1500,7 +1500,7 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
        
  done:
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
        
        return fi;
 }
@@ -1521,7 +1521,7 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
                return;
        }
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
        ic = camel_imap4_engine_queue (engine, NULL, "SUBSCRIBE %S\r\n", utf7_name);
@@ -1533,7 +1533,7 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
        if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
                camel_exception_xfer (ex, &ic->ex);
                camel_imap4_command_unref (ic);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        
@@ -1574,7 +1574,7 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
        
        camel_imap4_command_unref (ic);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1593,7 +1593,7 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
                return;
        }
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
        ic = camel_imap4_engine_queue (engine, NULL, "UNSUBSCRIBE %S\r\n", utf7_name);
@@ -1605,7 +1605,7 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
        if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
                camel_exception_xfer (ex, &ic->ex);
                camel_imap4_command_unref (ic);
-               CAMEL_SERVICE_UNLOCK (store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                return;
        }
        
@@ -1646,7 +1646,7 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
        
        camel_imap4_command_unref (ic);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1660,12 +1660,12 @@ imap4_noop (CamelStore *store, CamelException *ex)
        if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
                return;
        
-       CAMEL_SERVICE_LOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK (store, connect_lock);
        
        if (folder) {
                camel_folder_sync (folder, FALSE, ex);
                if (camel_exception_is_set (ex)) {
-                       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
                        return;
                }
        }
@@ -1682,5 +1682,5 @@ imap4_noop (CamelStore *store, CamelException *ex)
        if (folder && !camel_exception_is_set (ex))
                camel_imap4_summary_flush_updates (folder->summary, ex);
        
-       CAMEL_SERVICE_UNLOCK (store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
index f019558..5478c33 100644 (file)
@@ -1,3 +1,9 @@
+2007-02-23  Matthew Barnes  <mbarnes@redhat.com>
+
+       * camel-nntp-folder.c:
+       * camel-nntp-store.c:
+       Migrate from EMutex to GStaticMutex or GStaticRecMutex.
+
 2006-06-15  Andre Klapper  <a9016009@gmx.de>
 
        * camel-nntp-store.c: 
index cc7950b..a2f4401 100644 (file)
@@ -83,7 +83,7 @@ nntp_folder_refresh_info_online (CamelFolder *folder, CamelException *ex)
        nntp_store = (CamelNNTPStore *) folder->parent_store;
        nntp_folder = (CamelNNTPFolder *) folder;
        
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
 
        camel_nntp_command(nntp_store, ex, nntp_folder, &line, NULL);
 
@@ -92,7 +92,7 @@ nntp_folder_refresh_info_online (CamelFolder *folder, CamelException *ex)
                nntp_folder->changes = camel_folder_change_info_new();
        }
        
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
        
        if (changes) {
                camel_object_trigger_event ((CamelObject *) folder, "folder_changed", changes);
@@ -103,17 +103,17 @@ nntp_folder_refresh_info_online (CamelFolder *folder, CamelException *ex)
 static void
 nntp_folder_sync_online (CamelFolder *folder, CamelException *ex)
 {
-       CAMEL_SERVICE_LOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
        camel_folder_summary_save (folder->summary);
-       CAMEL_SERVICE_UNLOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
 }
 
 static void
 nntp_folder_sync_offline (CamelFolder *folder, CamelException *ex)
 {
-       CAMEL_SERVICE_LOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
        camel_folder_summary_save (folder->summary);
-       CAMEL_SERVICE_UNLOCK(folder->parent_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
 }
 
 static gboolean
@@ -177,13 +177,13 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder, const char *uid, Came
        }
        *msgid++ = 0;
        
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        stream = nntp_folder_download_message ((CamelNNTPFolder *) disco_folder, article, msgid, ex);
        if (stream)
                camel_object_unref (stream);
 
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
 }
 
 static CamelMimeMessage *
@@ -209,7 +209,7 @@ nntp_folder_get_message (CamelFolder *folder, const char *uid, CamelException *e
        }
        *msgid++ = 0;
 
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        /* Lookup in cache, NEWS is global messageid's so use a global cache path */
        stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL);
@@ -244,7 +244,7 @@ fail:
                changes = NULL;
        }
        
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
        
        if (changes) {
                camel_object_trigger_event ((CamelObject *) folder, "folder_changed", changes);
@@ -317,7 +317,7 @@ nntp_folder_append_message_online (CamelFolder *folder, CamelMimeMessage *mime_m
        struct _camel_header_raw *header, *savedhdrs, *n, *tail;
        char *group, *line;
        
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        /* send 'POST' command */
        ret = camel_nntp_command (nntp_store, ex, NULL, &line, "post");
@@ -328,7 +328,7 @@ nntp_folder_append_message_online (CamelFolder *folder, CamelMimeMessage *mime_m
                else if (ret != -1)
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                              _("Posting failed: %s"), line);
-               CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+               CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
                return;
        }
        
@@ -378,7 +378,7 @@ nntp_folder_append_message_online (CamelFolder *folder, CamelMimeMessage *mime_m
        g_free(group);
        header->next = savedhdrs;
 
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
        
        return;
 }
index 74118ff..2b9b302 100644 (file)
@@ -170,7 +170,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
        unsigned int len;
        char *path;
        
-       CAMEL_SERVICE_LOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
 
        if (ssl_mode != MODE_CLEAR) {
 #ifdef HAVE_SSL
@@ -260,7 +260,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
        store->current_folder = NULL;
        
  fail:
-       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
        return retval;
 }
 
@@ -360,7 +360,7 @@ nntp_disconnect_online (CamelService *service, gboolean clean, CamelException *e
        CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
        char *line;
        
-       CAMEL_SERVICE_LOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
        
        if (clean) {
                camel_nntp_raw_command (store, ex, &line, "quit");
@@ -368,7 +368,7 @@ nntp_disconnect_online (CamelService *service, gboolean clean, CamelException *e
        }
        
        if (!service_class->disconnect (service, clean, ex)) {
-               CAMEL_SERVICE_UNLOCK(store, connect_lock);      
+               CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
                return FALSE;
        }
        
@@ -377,7 +377,7 @@ nntp_disconnect_online (CamelService *service, gboolean clean, CamelException *e
        g_free(store->current_folder);
        store->current_folder = NULL;
 
-       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
        
        return TRUE;
 }
@@ -422,11 +422,11 @@ nntp_get_folder(CamelStore *store, const char *folder_name, guint32 flags, Camel
        CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
        CamelFolder *folder;
        
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        folder = camel_nntp_folder_new(store, folder_name, ex);
        
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
        
        return folder;
 }
@@ -609,13 +609,13 @@ nntp_store_get_subscribed_folder_info (CamelNNTPStore *store, const char *top, g
                                if (folder) {
                                        CamelFolderChangeInfo *changes = NULL;
 
-                                       CAMEL_SERVICE_LOCK(store, connect_lock);
+                                       CAMEL_SERVICE_REC_LOCK(store, connect_lock);
                                        camel_nntp_command(store, ex, folder, &line, NULL);
                                        if (camel_folder_change_info_changed(folder->changes)) {
                                                changes = folder->changes;
                                                folder->changes = camel_folder_change_info_new();
                                        }
-                                       CAMEL_SERVICE_UNLOCK(store, connect_lock);
+                                       CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
                                        if (changes) {
                                                camel_object_trigger_event((CamelObject *) folder, "folder_changed", changes);
                                                camel_folder_change_info_free(changes);
@@ -751,7 +751,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const char *top, guin
        int ret = -1;
        CamelFolderInfo *fi = NULL;
 
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        if (top == NULL)
                top = "";
@@ -821,7 +821,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const char *top, guin
        
        fi = nntp_store_get_cached_folder_info (nntp_store, top, flags, ex);
  error:
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
 
        return fi;
 }
@@ -883,7 +883,7 @@ nntp_store_subscribe_folder (CamelStore *store, const char *folder_name,
        CamelStoreInfo *si;
        CamelFolderInfo *fi;
        
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        si = camel_store_summary_path(CAMEL_STORE_SUMMARY(nntp_store->summary), folder_name);
        if (!si) {
@@ -897,14 +897,14 @@ nntp_store_subscribe_folder (CamelStore *store, const char *folder_name,
                        fi->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_NOCHILDREN;
                        camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
                        camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
-                       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
                        camel_object_trigger_event ((CamelObject *) nntp_store, "folder_subscribed", fi);
                        camel_folder_info_free (fi);
                        return;
                }
        }
        
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
 }
 
 static void
@@ -914,7 +914,7 @@ nntp_store_unsubscribe_folder (CamelStore *store, const char *folder_name,
        CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(store);
        CamelFolderInfo *fi;
        CamelStoreInfo *fitem;
-       CAMEL_SERVICE_LOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_LOCK(nntp_store, connect_lock);
        
        fitem = camel_store_summary_path(CAMEL_STORE_SUMMARY(nntp_store->summary), folder_name);
        
@@ -928,14 +928,14 @@ nntp_store_unsubscribe_folder (CamelStore *store, const char *folder_name,
                        fi = nntp_folder_info_from_store_info (nntp_store, nntp_store->do_short_folder_notation, fitem);
                        camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
                        camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
-                       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+                       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
                        camel_object_trigger_event ((CamelObject *) nntp_store, "folder_unsubscribed", fi);
                        camel_folder_info_free (fi);
                        return;
                }
        }
        
-       CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+       CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
 }
 
 /* stubs for various folder operations we're not implementing */
@@ -1200,7 +1200,6 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, char **line,
        int d;
        unsigned int u, u2;
        
-       e_mutex_assert_locked(((CamelService *)store)->priv->connect_lock);
        g_assert(store->stream->mode != CAMEL_NNTP_STREAM_DATA);
 
        camel_nntp_stream_set_mode(store->stream, CAMEL_NNTP_STREAM_LINE);
@@ -1322,8 +1321,6 @@ camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *
        int ret, retry;
        unsigned int u;
        
-       e_mutex_assert_locked(((CamelService *)store)->priv->connect_lock);
-
        if (((CamelDiscoStore *)store)->status == CAMEL_DISCO_STORE_OFFLINE) {
                camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
                                     _("Not connected."));
index 5fa02ed..a9b1b54 100644 (file)
@@ -95,6 +95,7 @@ void e_thread_put(EThread *e, EMsg *msg);
 int e_thread_busy(EThread *e);
 #endif
 
+#ifndef EDS_DISABLE_DEPRECATED
 /* sigh, another mutex interface, this one allows different mutex types, portably */
 typedef struct _EMutex EMutex;
 
@@ -110,5 +111,6 @@ int e_mutex_unlock(EMutex *m);
 void e_mutex_assert_locked(EMutex *m);
 /* this uses pthread cond's */
 int e_mutex_cond_wait(void *cond, EMutex *m);
+#endif
 
 #endif