File imap-locking.patch of Package evolution-data-server

Index: camel/providers/imap/camel-imap-command.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-command.c,v
retrieving revision 1.76.2.1
diff -u -r1.76.2.1 camel-imap-command.c
--- camel/providers/imap/camel-imap-command.c	12 Apr 2006 19:08:32 -0000	1.76.2.1
+++ camel/providers/imap/camel-imap-command.c	19 May 2006 15:19:00 -0000
@@ -38,7 +38,6 @@
 #include "camel-imap-folder.h"
 #include "camel-imap-store.h"
 #include "camel-imap-store-summary.h"
-#include "camel-imap-private.h"
 #include <camel/camel-exception.h>
 #include <camel/camel-private.h>
 #include <camel/camel-utf8.h>
Index: camel/providers/imap/camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.358.2.1
diff -u -r1.358.2.1 camel-imap-folder.c
--- camel/providers/imap/camel-imap-folder.c	21 Apr 2006 09:21:20 -0000	1.358.2.1
+++ camel/providers/imap/camel-imap-folder.c	19 May 2006 15:19:00 -0000
@@ -37,11 +37,11 @@
 /*#include "libedataserver/e-path.h"*/
 #include "libedataserver/e-time-utils.h"
 #include "libedataserver/e-data-server-util.h"
+#include "libedataserver/e-msgport.h"
 
 #include "camel-imap-folder.h"
 #include "camel-imap-command.h"
 #include "camel-imap-message-cache.h"
-#include "camel-imap-private.h"
 #include "camel-imap-search.h"
 #include "camel-imap-store.h"
 #include "camel-imap-summary.h"
@@ -70,6 +70,7 @@
 #include "camel-i18n.h"
 #include "camel/camel-store-summary.h"
 
+
 #define d(x) 
 
 /* set to -1 for infinite size (suggested max command-line length is
@@ -189,12 +190,6 @@
 	folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY |
 				 CAMEL_FOLDER_HAS_SEARCH_CAPABILITY);
 	
-	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);
-#endif
-
 	imap_folder->need_rescan = TRUE;
 }
 
@@ -347,9 +342,7 @@
 	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_message_cache_clear (imap_folder->cache);
-		CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
 		imap_folder->need_rescan = FALSE;
 		camel_imap_folder_changed (folder, exists, NULL, ex);
 		return;
@@ -423,12 +416,6 @@
 		camel_object_unref (CAMEL_OBJECT (imap_folder->search));
 	if (imap_folder->cache)
 		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);
-#endif
-	g_free(imap_folder->priv);
 }
 
 static int
@@ -475,26 +462,28 @@
 	CamelImapStore *imap_store = (CamelImapStore *)folder->parent_store;
 	char *folder_dir, *summary_path, *state_file;
 	char *folders;
-
+	
+	CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+	
 	folders = g_strconcat (imap_store->storage_path, "/folders", NULL);
 	folder_dir = imap_path_to_physical (folders, new);
 	g_free (folders);
 	summary_path = g_strdup_printf("%s/summary", folder_dir);
-
-	CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
+	
 	camel_imap_message_cache_set_path(imap_folder->cache, folder_dir);
-	CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
-
+	
 	camel_folder_summary_set_filename(folder->summary, summary_path);
-
+	
 	state_file = g_strdup_printf ("%s/cmeta", folder_dir);
 	camel_object_set(folder, NULL, CAMEL_OBJECT_STATE_FILE, state_file, NULL);
 	g_free(state_file);
-
+	
 	g_free(summary_path);
 	g_free(folder_dir);
-
+	
 	((CamelFolderClass *)disco_folder_class)->rename(folder, new);
+	
+	CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
 }
 
 static void
@@ -1202,21 +1191,23 @@
 	char *uid;
 
 	uid = get_temp_uid ();
-
+	
+	CAMEL_SERVICE_LOCK (imap_store, connect_lock);
+	
 	camel_imap_summary_add_offline (folder->summary, uid, message, info);
-	CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
 	camel_imap_message_cache_insert_wrapper (cache, uid, "",
 						 CAMEL_DATA_WRAPPER (message), ex);
-	CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
-
+	
 	changes = camel_folder_change_info_new ();
 	camel_folder_change_info_add_uid (changes, uid);
-	camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed",
-				    changes);
+	camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", changes);
 	camel_folder_change_info_free (changes);
 
 	camel_disco_diary_log (CAMEL_DISCO_STORE (imap_store)->diary,
 			       CAMEL_DISCO_DIARY_FOLDER_APPEND, folder, uid);
+	
+	CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
+	
 	if (appended_uid)
 		*appended_uid = uid;
 	else
@@ -1327,21 +1318,22 @@
 	CamelImapResponse *response;
 	char *uid;
 	int count;
-
+	
+	CAMEL_SERVICE_LOCK (store, connect_lock);
+	
 	count = camel_folder_summary_count (folder->summary);
-	response = do_append (folder, message, info, &uid, ex);
-	if (!response)
+	if (!(response = do_append (folder, message, info, &uid, ex))) {
+		CAMEL_SERVICE_UNLOCK (store, connect_lock);
 		return;
+	}
 	
 	if (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_message_cache_insert_wrapper (
 			CAMEL_IMAP_FOLDER (folder)->cache, uid,
 			"", CAMEL_DATA_WRAPPER (message), ex);
-		CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
 		if (appended_uid)
 			*appended_uid = uid;
 		else
@@ -1352,10 +1344,10 @@
 	camel_imap_response_free (store, response);
 	
 	/* Make sure a "folder_changed" is emitted. */
-	CAMEL_SERVICE_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);
 }
 
@@ -1368,19 +1360,20 @@
 	CamelImapResponse *response;
 	char *uid;
 	
-	response = do_append (folder, message, info, &uid, ex);
-	if (!response)
+	CAMEL_SERVICE_LOCK (store, connect_lock);
+	
+	if (!(response = do_append (folder, message, info, &uid, ex))) {
+		CAMEL_SERVICE_UNLOCK (store, connect_lock);
 		return;
+	}
 	
 	if (uid) {
 		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_message_cache_copy (imap_folder->cache, olduid,
 					       imap_folder->cache, uid, ex);
-		CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
-
+		
 		if (appended_uid)
 			*appended_uid = uid;
 		else
@@ -1389,6 +1382,8 @@
 		*appended_uid = NULL;
 	
 	camel_imap_response_free (store, response);
+	
+	CAMEL_SERVICE_UNLOCK (store, connect_lock);
 }
 
 
@@ -1405,17 +1400,9 @@
 	CamelMessageInfo *mi;
 	char *uid, *destuid;
 	int i;
-
-	/* We grab the store's command lock first, and then grab the
-	 * source and destination cache_locks. This way we can't
-	 * 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);
-
+	
 	if (transferred_uids) {
 		*transferred_uids = g_ptr_array_new ();
 		g_ptr_array_set_size (*transferred_uids, uids->len);
@@ -1451,16 +1438,15 @@
 		if (delete_originals)
 			camel_folder_delete_message (source, uid);
 	}
-
-	CAMEL_IMAP_FOLDER_UNLOCK (dest, cache_lock);
-	CAMEL_IMAP_FOLDER_UNLOCK (source, cache_lock);
-
+	
 	camel_object_trigger_event (CAMEL_OBJECT (dest), "folder_changed", changes);
 	camel_folder_change_info_free (changes);
 
 	camel_disco_diary_log (CAMEL_DISCO_STORE (store)->diary,
 			       CAMEL_DISCO_DIARY_FOLDER_TRANSFER,
 			       source, dest, uids, delete_originals);
+	
+	CAMEL_SERVICE_UNLOCK (store, connect_lock);
 }
 
 static void
@@ -1490,22 +1476,14 @@
 
 	src = imap_uid_set_to_array (source->summary, srcset);
 	dest = imap_uid_set_to_array (destination->summary, destset);
-
+	
 	if (src && dest && src->len == dest->len) {
-		/* We don't have to worry about deadlocking on the
-		 * 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);
 		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);
-
+		
 		imap_uid_array_free (src);
 		imap_uid_array_free (dest);
 		return;
@@ -1567,7 +1545,9 @@
 	qsort (uids->pdata, uids->len, sizeof (void *), uid_compar);
 	
 	/* Now copy the messages */
+	CAMEL_SERVICE_LOCK (store, connect_lock);
 	do_copy(source, uids, dest, delete_originals, ex);
+	CAMEL_SERVICE_UNLOCK (store, connect_lock);
 	if (camel_exception_is_set (ex))
 		return;
 
@@ -1587,12 +1567,15 @@
 			 gboolean delete_originals, CamelException *ex)
 {
 	CamelDiscoDiary *diary = CAMEL_DISCO_STORE (source->parent_store)->diary;
+	CamelStore *store = source->parent_store;
 	GPtrArray *realuids;
 	int first, i;
 	const char *uid;
 	CamelMimeMessage *message;
 	CamelMessageInfo *info;
 	
+	CAMEL_SERVICE_LOCK (store, connect_lock);
+	
 	qsort (uids->pdata, uids->len, sizeof (void *), uid_compar);
 	
 	/* This is trickier than append_resyncing, because some of
@@ -1649,10 +1632,12 @@
 	}
 
 	g_ptr_array_free (realuids, FALSE);
-
+	
 	/* FIXME */
 	if (transferred_uids)
 		*transferred_uids = NULL;
+	
+	CAMEL_SERVICE_UNLOCK (store, connect_lock);
 }
 
 static GPtrArray *
@@ -1660,36 +1645,36 @@
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	GPtrArray *matches;
-
+	
 	/* we could get around this by creating a new search object each time,
 	   but i doubt its worth it since any long operation would lock the
 	   command channel too */
-	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
-
+	CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+	
 	camel_folder_search_set_folder (imap_folder->search, folder);
 	matches = camel_folder_search_search(imap_folder->search, expression, NULL, ex);
-
-	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
-
+	
+	CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+	
 	return matches;
 }
 
 static GPtrArray *
-imap_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex)
+imap_search_by_uids (CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex)
 {
-	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER(folder);
+	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	GPtrArray *matches;
-
+	
 	if (uids->len == 0)
-		return g_ptr_array_new();
-
-	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
-
+		return g_ptr_array_new ();
+	
+	CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+	
 	camel_folder_search_set_folder(imap_folder->search, folder);
 	matches = camel_folder_search_search(imap_folder->search, expression, uids, ex);
-
-	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
-
+	
+	CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+	
 	return matches;
 }
 
@@ -1697,14 +1682,14 @@
 imap_search_free (CamelFolder *folder, GPtrArray *uids)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
-
+	
 	g_return_if_fail (imap_folder->search);
-
-	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
-
+	
+	CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
+	
 	camel_folder_search_free_result (imap_folder->search, uids);
-
-	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
+	
+	CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
 }
 
 static CamelMimeMessage *get_message (CamelImapFolder *imap_folder,
@@ -2056,7 +2041,7 @@
 	CamelMimeMessage *msg = NULL;
 	CamelStream *stream = NULL;
 	int retry;
-
+	
 	mi = (CamelImapMessageInfo *)camel_folder_summary_uid (folder->summary, uid);
 	if (mi == NULL) {
 		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
@@ -2066,7 +2051,7 @@
 
 	/* If its cached in full, just get it as is, this is only a shortcut,
 	   since we get stuff from the cache anyway.  It affects a busted connection though. */
-	if ( (stream = camel_imap_folder_fetch_data(imap_folder, uid, "", TRUE, NULL))
+	if ((stream = camel_imap_folder_fetch_data(imap_folder, uid, "", TRUE, NULL))
 	     && (msg = get_message_simple(imap_folder, uid, stream, ex)))
 		goto done;
 
@@ -2095,7 +2080,7 @@
 				char *body, *found_uid;
 				int i;
 				
-				CAMEL_SERVICE_LOCK(store, connect_lock);
+				CAMEL_SERVICE_LOCK (store, connect_lock);
 				if (!camel_imap_store_connected(store, ex)) {
 					CAMEL_SERVICE_UNLOCK(store, connect_lock);
 					camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
@@ -2104,8 +2089,7 @@
 				}
 				
 				response = camel_imap_command (store, folder, ex, "UID FETCH %s BODY", uid);
-				CAMEL_SERVICE_UNLOCK(store, connect_lock);
-
+				
 				if (response) {
 					for (i = 0, body = NULL; i < response->untagged->len; i++) {
 						fetch_data = parse_fetch_response (imap_folder, response->untagged->pdata[i]);
@@ -2125,7 +2109,7 @@
 						imap_parse_body ((const char **) &body, folder, mi->info.content);
 						camel_folder_summary_touch (folder->summary);
 					}
-
+					
 					if (fetch_data)
 						g_datalist_clear (&fetch_data);
 					
@@ -2133,6 +2117,8 @@
 				} else {
 					camel_exception_clear(ex);
 				}
+				
+				CAMEL_SERVICE_UNLOCK (store, connect_lock);
 			}
 
 			if (camel_debug_start("imap:folder")) {
@@ -2637,9 +2623,7 @@
 			}
 			
 			camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
-			CAMEL_IMAP_FOLDER_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_folder_summary_remove (folder->summary, info);
 			camel_message_info_free(info);
 		}
@@ -2686,36 +2670,23 @@
 	char *found_uid;
 	int i;
 	
-	/* EXPUNGE responses have to modify the cache, which means
-	 * they have to grab the cache_lock while holding the
-	 * connect_lock.
-
-	 * Because getting the service lock may cause MUCH unecessary
-	 * delay when we already have the data locally, we do the
-	 * locking separately.  This could cause a race
-	 * 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_SERVICE_LOCK (store, connect_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);
 	
-	if (stream || cache_only)
+	if (stream || cache_only) {
+		CAMEL_SERVICE_UNLOCK (store, connect_lock);
 		return stream;
-
+	}
+	
 	camel_exception_clear(ex);
-
-	CAMEL_SERVICE_LOCK (store, connect_lock);
-	CAMEL_IMAP_FOLDER_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);
 		return NULL;
 	}
@@ -2730,11 +2701,9 @@
 					       "UID FETCH %s BODY.PEEK[%s]",
 					       uid, section_text);
 	}
-	/* We won't need the connect_lock again after this. */
-	CAMEL_SERVICE_UNLOCK (store, connect_lock);
 	
 	if (!response) {
-		CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+		CAMEL_SERVICE_UNLOCK (store, connect_lock);
 		return NULL;
 	}
 	
@@ -2748,8 +2717,9 @@
 		g_datalist_clear (&fetch_data);
 		stream = NULL;
 	}
+	
 	camel_imap_response_free (store, response);
-	CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
+	
 	if (!stream) {
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
 				      _("Could not find message body in FETCH response."));
@@ -2758,6 +2728,8 @@
 		g_datalist_clear (&fetch_data);
 	}
 	
+	CAMEL_SERVICE_UNLOCK (store, connect_lock);
+	
 	return stream;
 }
 
@@ -2769,6 +2741,8 @@
 	gboolean cache_header = TRUE, header = FALSE;
 	size_t body_len = 0;
 	
+	CAMEL_SERVICE_ASSERT_LOCKED (((CamelFolder *) imap_folder)->parent_store, connect_lock);
+	
 	if (*response != '(') {
 		long seq;
 		
@@ -2887,11 +2861,9 @@
 		if (header && !cache_header) {
 			stream = camel_stream_mem_new_with_buffer (body, body_len);
 		} else {
-			CAMEL_IMAP_FOLDER_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);
 			if (stream == NULL)
 				stream = camel_stream_mem_new_with_buffer (body, body_len);
 		}
Index: camel/providers/imap/camel-imap-folder.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-folder.h,v
retrieving revision 1.43
diff -u -r1.43 camel-imap-folder.h
--- camel/providers/imap/camel-imap-folder.h	31 Aug 2005 04:26:02 -0000	1.43
+++ camel/providers/imap/camel-imap-folder.h	19 May 2006 15:19:00 -0000
@@ -44,9 +44,7 @@
 
 struct _CamelImapFolder {
 	CamelDiscoFolder parent_object;
-
-	struct _CamelImapFolderPrivate *priv;
-
+	
 	CamelFolderSearch *search;
 	CamelImapMessageCache *cache;
 
Index: camel/providers/imap/camel-imap-private.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-private.h,v
retrieving revision 1.12
diff -u -r1.12 camel-imap-private.h
--- camel/providers/imap/camel-imap-private.h	31 Aug 2005 04:26:02 -0000	1.12
+++ camel/providers/imap/camel-imap-private.h	19 May 2006 15:19:00 -0000
@@ -28,46 +28,6 @@
 #pragma }
 #endif /* __cplusplus */
 
-/* need a way to configure and save this data, if this header is to
-   be installed.  For now, dont install it */
-
-#ifdef HAVE_CONFIG_H
-#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 */
-#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))
-#else
-#define CAMEL_IMAP_FOLDER_LOCK(f, l)
-#define CAMEL_IMAP_FOLDER_UNLOCK(f, l)
-#endif
-
-struct _CamelImapWrapperPrivate {
-#ifdef ENABLE_THREADS
-	GMutex *lock;
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l) (g_mutex_lock(((CamelImapWrapper *)f)->priv->l))
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapWrapper *)f)->priv->l))
-#else
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l)
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l)
-#endif
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: camel/providers/imap/camel-imap-search.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-search.c,v
retrieving revision 1.21
diff -u -r1.21 camel-imap-search.c
--- camel/providers/imap/camel-imap-search.c	15 Sep 2005 17:54:00 -0000	1.21
+++ camel/providers/imap/camel-imap-search.c	19 May 2006 15:19:00 -0000
@@ -34,7 +34,6 @@
 #include "camel-imap-folder.h"
 #include "camel-imap-store.h"
 #include "camel-imap-search.h"
-#include "camel-imap-private.h"
 #include "camel-imap-utils.h"
 #include "camel-imap-summary.h"
 
Index: camel/providers/imap/camel-imap-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-store.c,v
retrieving revision 1.340.2.4
diff -u -r1.340.2.4 camel-imap-store.c
--- camel/providers/imap/camel-imap-store.c	1 May 2006 21:15:19 -0000	1.340.2.4
+++ camel/providers/imap/camel-imap-store.c	19 May 2006 15:19:00 -0000
@@ -58,7 +58,6 @@
 #include "camel-imap-command.h"
 #include "camel-imap-folder.h"
 #include "camel-imap-message-cache.h"
-#include "camel-imap-private.h"
 #include "camel-imap-store-summary.h"
 #include "camel-imap-store.h"
 #include "camel-imap-summary.h"
Index: camel/providers/imap/camel-imap-wrapper.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-wrapper.c,v
retrieving revision 1.14
diff -u -r1.14 camel-imap-wrapper.c
--- camel/providers/imap/camel-imap-wrapper.c	15 Sep 2005 18:08:50 -0000	1.14
+++ camel/providers/imap/camel-imap-wrapper.c	19 May 2006 15:19:00 -0000
@@ -30,7 +30,6 @@
 
 #include "camel-imap-folder.h"
 #include "camel-imap-wrapper.h"
-#include "camel-imap-private.h"
 #include "camel-exception.h"
 #include "camel-stream-filter.h"
 #include "camel-mime-filter-basic.h"
@@ -38,6 +37,17 @@
 #include "camel-mime-filter-charset.h"
 #include "camel-mime-part.h"
 
+#include "libedataserver/e-msgport.h"
+
+
+struct _CamelImapWrapperPrivate {
+	GMutex *lock;
+};
+
+#define CAMEL_IMAP_WRAPPER_LOCK(f, l) (g_mutex_lock(((CamelImapWrapper *)f)->priv->l))
+#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapWrapper *)f)->priv->l))
+
+
 static CamelDataWrapperClass *parent_class = NULL;
 
 /* Returns the class for a CamelDataWrapper */
@@ -68,10 +78,9 @@
 		g_free (imap_wrapper->uid);
 	if (imap_wrapper->part)
 		g_free (imap_wrapper->part_spec);
-
-#ifdef ENABLE_THREADS
+	
 	g_mutex_free (imap_wrapper->priv->lock);
-#endif
+	
 	g_free (imap_wrapper->priv);
 }
 
@@ -81,9 +90,7 @@
 	CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (object);
 
 	imap_wrapper->priv = g_new0 (struct _CamelImapWrapperPrivate, 1);
-#ifdef ENABLE_THREADS
 	imap_wrapper->priv->lock = g_mutex_new ();
-#endif
 }
 
 CamelType
openSUSE Build Service is sponsored by