+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
+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
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
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);
}
{
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);
}
{
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
{
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);
}
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);
{
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;
}
CF_CLASS (folder)->delete (folder);
- CAMEL_FOLDER_UNLOCK (folder, lock);
+ CAMEL_FOLDER_REC_UNLOCK (folder, lock);
camel_object_trigger_event (folder, "deleted", NULL);
}
/* 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 */
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))
/* ********************************************************************** */
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;
#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)
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();
/*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);
g_warning("camel_type_register: Trying to re-register class '%s'", name);
klass = NULL;
}
- E_UNLOCK(type_lock);
+ TYPE_UNLOCK();
return klass;
}
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;
}
camel_type_class_init(klass, klass);
- E_UNLOCK(type_lock);
+ TYPE_UNLOCK();
return klass;
}
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;
}
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;
pthread_mutex_unlock(&lock);
}
- e_mutex_lock(o->hooks->lock);
+ g_static_rec_mutex_lock(&o->hooks->lock);
return o->hooks;
}
#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 {
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 {
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 = {
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);
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
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);
}
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;
}
}
CAMEL_SERVICE_UNLOCK (service, connect_op_lock);
- CAMEL_SERVICE_UNLOCK (service, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
return ret;
}
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) {
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;
/* 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;
}
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
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);
}
&& 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--;
camel_folder_rename(folder, new);
g_free(new);
- CAMEL_FOLDER_UNLOCK(folder, lock);
+ CAMEL_FOLDER_REC_UNLOCK(folder, lock);
camel_object_unref(folder);
}
/* 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);
}
}
#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);
int word_cache_count;
EDList word_cache;
GHashTable *words;
- EMutex *lock;
+ GStaticRecMutex lock;
};
/* Root block of text index */
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
if (p->links)
camel_object_unref((CamelObject *)p->links);
- e_mutex_destroy(p->lock);
+ g_static_rec_mutex_free(&p->lock);
g_free(p);
}
+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):
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
};
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)
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);
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);
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);
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);
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);
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);
}
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.
/* 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;
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;
}
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 *
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;
}
- CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
is_locked = FALSE;
/*
g_free (container_id);
end1:
if (is_locked)
- CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
return;
}
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) {
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);
}
camel_object_unref (mail_msg);
- CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
+ CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
}
/******************** Caching stuff ends *************************/
i++;
}
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);
}
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);
}
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) ;
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 = 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
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;
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;
}
*/
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;
}
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;
}
gw_store->current_folder = source;
- CAMEL_SERVICE_UNLOCK (source->parent_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (source->parent_store, connect_lock);
}
static void
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);
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;
}
}
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;
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);
}
}
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;
}
#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
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
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;
}
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;
}
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);
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;
}
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;
}
}
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);
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;
}
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);
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;
}
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;
}
}
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;
}
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"));
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;
}
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*/
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
* 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;
}
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)) {
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:
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);
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;
}
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);
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;
}
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;
}
g_hash_table_remove (priv->parent_hash, container);
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static void
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;
}
{
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;
}
g_free (oldpath);
g_free (newpath);
- CAMEL_SERVICE_UNLOCK (groupwise_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (groupwise_store, connect_lock);
}
char *
+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):
va_list ap;
char *cmd;
- CAMEL_SERVICE_LOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_LOCK (store, connect_lock);
if (fmt) {
va_start (ap, fmt);
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);
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;
}
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;
}
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;
}
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;
}
* 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) {
}
g_free (response);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
/**
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;
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++) {
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;
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);
}
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);
* 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;
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);
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);
}
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
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)) {
}
/* 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
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;
}
}
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;
}
camel_imap_response_free (store, response);
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static void
* 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;
}
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);
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);
/* 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 *
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);
/* 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
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
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;
* 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 ();
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);
* 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);
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++) {
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");
CamelMessageInfo *info;
int len;
- CAMEL_SERVICE_ASSERT_LOCKED (folder->parent_store, connect_lock);
-
changes = camel_folder_change_info_new ();
if (expunged) {
int i, id;
}
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);
}
* 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;
}
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;
}
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."));
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);
}
#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 {
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;
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;
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;
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) {
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;
}
/* 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);
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;
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 *
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;
}
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;
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);
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;
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;
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);
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;
}
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) {
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;
}
}
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;
}
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;
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
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;
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 *
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;
}
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
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;
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;
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;
}
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;
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
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;
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
+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:
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) {
done:
- CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
}
static void
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)
done:
- CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
}
static int
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);
}
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;
done:
- CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
return 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) {
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;
}
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
}
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) {
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 *
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;
}
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;
}
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);
}
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;
}
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)
camel_imap4_command_unref (ic);
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return 0;
}
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;
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) {
folder = camel_imap4_folder_new (store, folder_name, ex);
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return folder;
}
done:
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return folder;
}
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');
done:
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
g_ptr_array_free (array, TRUE);
g_free (utf7_name);
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);
done:
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return fi;
}
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");
camel_imap4_command_unref (ic0);
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return;
}
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static void
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');
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;
}
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static int
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
* and query the server. */
goto check_online;
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return fi;
}
#else
fi = inbox;
}
}
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return fi;
}
#endif
done:
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return fi;
}
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);
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;
}
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static void
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);
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;
}
camel_imap4_command_unref (ic);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
static void
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;
}
}
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);
}
+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:
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);
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);
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
}
*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 *
}
*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);
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);
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");
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;
}
g_free(group);
header->next = savedhdrs;
- CAMEL_SERVICE_UNLOCK(nntp_store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK(nntp_store, connect_lock);
return;
}
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
store->current_folder = NULL;
fail:
- CAMEL_SERVICE_UNLOCK(store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
return retval;
}
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");
}
if (!service_class->disconnect (service, clean, ex)) {
- CAMEL_SERVICE_UNLOCK(store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
return FALSE;
}
g_free(store->current_folder);
store->current_folder = NULL;
- CAMEL_SERVICE_UNLOCK(store, connect_lock);
+ CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);
return TRUE;
}
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;
}
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);
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 = "";
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;
}
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) {
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
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);
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 */
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);
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."));
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;
void e_mutex_assert_locked(EMutex *m);
/* this uses pthread cond's */
int e_mutex_cond_wait(void *cond, EMutex *m);
+#endif
#endif