aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
author6 <NotZed@Ximian.com>2001-09-27 04:18:54 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-09-27 04:18:54 +0800
commit88186e014e53c71b1ad4a5115a0bb375342ed31b (patch)
treef10587e1d38c716cf2602e0f0ec273b86ab607f9 /camel
parente3bfc5a9cc44be964d0886c6b19b4d8310822b7b (diff)
downloadgsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar.gz
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar.bz2
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar.lz
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar.xz
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.tar.zst
gsoc2013-evolution-88186e014e53c71b1ad4a5115a0bb375342ed31b.zip
Emptied VeeStorePrivate, member wasn't used.
2001-09-26 <NotZed@Ximian.com> * camel-vee-store.c: Emptied VeeStorePrivate, member wasn't used. * camel-vee-folder.c (camel_vee_folder_set_expression): Lock changed list separately. (camel_vee_folder_remove_folder): " (camel_vee_folder_set_folders): Use changed_lock for changed list. (vee_refresh_info): Use changed_lock, also just grab the list, reset it in the lock, and do the work unlocked. (vee_sync): Use changed lock for changed list. (folder_changed): ". All this kills a deadlock with sync/expunge. * camel-private.h (CamelVeeFolderPrivate): Added a new lock for the folders-changed list. (CamelVeeStorePrivate): Removed, defined in camel-vee-store.c, thanks to a pedantic. svn path=/trunk/; revision=13163
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog18
-rw-r--r--camel/camel-private.h12
-rw-r--r--camel/camel-vee-folder.c30
-rw-r--r--camel/camel-vee-store.c1
4 files changed, 38 insertions, 23 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6e7b588a2a..984bda49bb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,21 @@
+2001-09-26 <NotZed@Ximian.com>
+
+ * camel-vee-store.c: Emptied VeeStorePrivate, member wasn't used.
+
+ * camel-vee-folder.c (camel_vee_folder_set_expression): Lock
+ changed list separately.
+ (camel_vee_folder_remove_folder): "
+ (camel_vee_folder_set_folders): Use changed_lock for changed list.
+ (vee_refresh_info): Use changed_lock, also just grab the list,
+ reset it in the lock, and do the work unlocked.
+ (vee_sync): Use changed lock for changed list.
+ (folder_changed): ". All this kills a deadlock with sync/expunge.
+
+ * camel-private.h (CamelVeeFolderPrivate): Added a new lock for
+ the folders-changed list.
+ (CamelVeeStorePrivate): Removed, defined in camel-vee-store.c,
+ thanks to a pedantic.
+
2001-09-26 Jeffrey Stedfast <fejj@ximian.com>
* Makefile.am: Fix Ettore's fix.
diff --git a/camel/camel-private.h b/camel/camel-private.h
index 8d65e0ace1..32cde53068 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -164,17 +164,6 @@ struct _CamelFolderSummaryPrivate {
#define CAMEL_SUMMARY_UNLOCK(f, l)
#endif
-struct _CamelVeeStorePrivate {
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_VEE_STORE_LOCK(f, l) (e_mutex_lock(((CamelVeeStore *)f)->priv->l))
-#define CAMEL_VEE_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelVeeStore *)f)->priv->l))
-#else
-#define CAMEL_VEE_STORE_LOCK(f, l)
-#define CAMEL_VEE_STORE_UNLOCK(f, l)
-#endif
-
struct _CamelVeeFolderPrivate {
GList *folders; /* lock using subfolder_lock before changing/accessing */
GList *folders_changed; /* for list of folders that have changed between updates */
@@ -182,6 +171,7 @@ struct _CamelVeeFolderPrivate {
#ifdef ENABLE_THREADS
GMutex *summary_lock; /* for locking vfolder summary */
GMutex *subfolder_lock; /* for locking the subfolder list */
+ GMutex *changed_lock; /* for locking the folders-changed list */
#endif
};
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 5cafadc7f5..1cf0386e25 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -148,6 +148,7 @@ camel_vee_folder_init (CamelVeeFolder *obj)
#ifdef ENABLE_THREADS
p->summary_lock = g_mutex_new();
p->subfolder_lock = g_mutex_new();
+ p->changed_lock = g_mutex_new();
#endif
}
@@ -188,6 +189,7 @@ camel_vee_folder_finalise (CamelObject *obj)
#ifdef ENABLE_THREADS
g_mutex_free(p->summary_lock);
g_mutex_free(p->subfolder_lock);
+ g_mutex_free(p->changed_lock);
#endif
g_free(p);
}
@@ -301,8 +303,10 @@ camel_vee_folder_set_expression(CamelVeeFolder *vf, const char *query)
node = node->next;
}
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
g_list_free(p->folders_changed);
p->folders_changed = NULL;
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
}
@@ -360,7 +364,9 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
p->folders_changed = g_list_remove(p->folders_changed, sub);
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
if (g_list_find(p->folders, sub) == NULL) {
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
@@ -421,11 +427,11 @@ camel_vee_folder_set_folders(CamelVeeFolder *vf, GList *folders)
camel_object_unref((CamelObject *)folder);
/* if this was a changed folder, re-update it while we're here */
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
changed = g_list_find(p->folders_changed, folder) != NULL;
if (changed)
p->folders_changed = g_list_remove(p->folders_changed, folder);
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
if (changed)
vee_folder_build_folder(vf, folder, NULL);
} else {
@@ -476,11 +482,14 @@ static void vee_refresh_info(CamelFolder *folder, CamelException *ex)
{
CamelVeeFolder *vf = (CamelVeeFolder *)folder;
struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
+ GList *node, *list;
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
+ list = p->folders_changed;
+ p->folders_changed = NULL;
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
- node = p->folders_changed;
+ node = list;
while (node) {
CamelFolder *f = node->data;
@@ -490,10 +499,7 @@ static void vee_refresh_info(CamelFolder *folder, CamelException *ex)
node = node->next;
}
- g_list_free(p->folders_changed);
- p->folders_changed = NULL;
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+ g_list_free(list);
}
static void
@@ -519,8 +525,10 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
node = node->next;
}
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
g_list_free(p->folders_changed);
p->folders_changed = NULL;
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
}
@@ -1015,7 +1023,7 @@ folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder
/* if not auto-updating, only propagate changed/removed events, not added items */
if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_LOCK(vf, changed_lock);
/* add this folder to our changed folders list if we have stuff we can't catch easily */
/* Unfortuantely if its a change that doesn't affect the match, we're still going to
rerun it :( */
@@ -1023,7 +1031,7 @@ folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder
if (g_list_find(vf->priv->folders_changed, sub) != NULL)
vf->priv->folders_changed = g_list_prepend(vf->priv->folders_changed, sub);
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+ CAMEL_VEE_FOLDER_UNLOCK(vf, changed_lock);
CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
CAMEL_VEE_FOLDER_LOCK(folder_unmatched, summary_lock);
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index b8974e5d44..a5e2a43070 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -36,7 +36,6 @@ static CamelFolder *vee_get_trash (CamelStore *store, CamelException *ex);
static CamelFolderInfo *vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelException *ex);
struct _CamelVeeStorePrivate {
- CamelFolderInfo *folder_info;
};
#define _PRIVATE(o) (((CamelVeeStore *)(o))->priv)