diff options
Diffstat (limited to 'camel/camel-vee-folder.c')
-rw-r--r-- | camel/camel-vee-folder.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index 805f800b60..c17f7a0bde 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -1,5 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2000 Ximian Inc. + * Copyright (C) 2000-2003 Ximian Inc. * * Authors: Michael Zucchi <notzed@ximian.com> * Jeffrey Stedfast <fejj@ximian.com> @@ -24,6 +25,7 @@ #endif #include <string.h> +#include <pthread.h> #include "camel-exception.h" #include "camel-vee-folder.h" @@ -87,16 +89,11 @@ static CamelFolderClass *camel_vee_folder_parent; /* use folder_unmatched->summary_lock for access to unmatched_uids or appropriate internals, for consistency */ static CamelVeeFolder *folder_unmatched; static GHashTable *unmatched_uids; /* a refcount of uid's that are matched by any rules */ -#ifdef ENABLE_THREADS -#include <pthread.h> static pthread_mutex_t unmatched_lock = PTHREAD_MUTEX_INITIALIZER; /* only used to initialise folder_unmatched */ #define UNMATCHED_LOCK() pthread_mutex_lock(&unmatched_lock) #define UNMATCHED_UNLOCK() pthread_mutex_unlock(&unmatched_lock) -#else -#define UNMATCHED_LOCK() -#define UNMATCHED_UNLOCK() -#endif + CamelType camel_vee_folder_get_type (void) @@ -164,13 +161,10 @@ camel_vee_folder_init (CamelVeeFolder *obj) obj->changes = camel_folder_change_info_new(); obj->search = camel_folder_search_new(); - -#ifdef ENABLE_THREADS + p->summary_lock = g_mutex_new(); p->subfolder_lock = g_mutex_new(); p->changed_lock = g_mutex_new(); -#endif - } static void @@ -206,12 +200,11 @@ camel_vee_folder_finalise (CamelObject *obj) camel_folder_change_info_free(vf->changes); camel_object_unref((CamelObject *)vf->search); - -#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); } @@ -1367,9 +1360,7 @@ folder_changed_change_uid(CamelFolder *sub, const char *uid, const char hash[8], } struct _folder_changed_msg { -#ifdef ENABLE_THREADS CamelSessionThreadMsg msg; -#endif CamelFolderChangeInfo *changes; CamelFolder *sub; CamelVeeFolder *vf; @@ -1600,20 +1591,17 @@ folder_changed_free(CamelSession *session, CamelSessionThreadMsg *msg) camel_object_unref((CamelObject *)m->sub); } -#ifdef ENABLE_THREADS static CamelSessionThreadOps folder_changed_ops = { folder_changed_change, folder_changed_free, }; -#endif static void folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder *vf) { struct _folder_changed_msg *m; CamelSession *session = ((CamelService *)((CamelFolder *)vf)->parent_store)->session; - -#ifdef ENABLE_THREADS + m = camel_session_thread_msg_new(session, &folder_changed_ops, sizeof(*m)); m->changes = camel_folder_change_info_new(); camel_folder_change_info_cat(m->changes, changes); @@ -1622,15 +1610,6 @@ folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder m->vf = vf; camel_object_ref((CamelObject *)vf); camel_session_thread_queue(session, &m->msg, 0); -#else - m = g_malloc(sizeof(*m)); - m->changes = changes; - m->sub = sub; - m->vf = vf; - folder_changed_change(session, &m->msg); - folder_changed_free(&m->msg); - g_free(m); -#endif } /* track flag changes in the summary, we just promote it to a folder_changed event */ |