diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-07 10:22:31 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-07 10:22:31 +0800 |
commit | b3210e40c2bd0fade204890a6f49e2a24f5ad04c (patch) | |
tree | 8871c4a76e084880d53b185d8b1e7c569946b270 | |
parent | 86f1c5d69932b562b2d502848bfe6bf7b0d108f5 (diff) | |
download | gsoc2013-evolution-b3210e40c2bd0fade204890a6f49e2a24f5ad04c.tar.gz gsoc2013-evolution-b3210e40c2bd0fade204890a6f49e2a24f5ad04c.tar.zst gsoc2013-evolution-b3210e40c2bd0fade204890a6f49e2a24f5ad04c.zip |
Added mutex locking where appropriate.
2004-04-06 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap4/camel-imap4-folder.c: Added mutex locking where
appropriate.
svn path=/trunk/; revision=25348
-rw-r--r-- | camel/ChangeLog | 3 | ||||
-rw-r--r-- | camel/providers/imap4/camel-imap4-folder.c | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 78ee86773e..e0366d49ba 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,8 @@ 2004-04-06 Jeffrey Stedfast <fejj@ximian.com> + * providers/imap4/camel-imap4-folder.c: Added mutex locking where + appropriate. + * providers/imap4/camel-imap4-store.c: Added mutex locking where appropriate. diff --git a/camel/providers/imap4/camel-imap4-folder.c b/camel/providers/imap4/camel-imap4-folder.c index 9c88e596aa..a88ca71857 100644 --- a/camel/providers/imap4/camel-imap4-folder.c +++ b/camel/providers/imap4/camel-imap4-folder.c @@ -36,6 +36,7 @@ #include <time.h> #include <camel/camel-utf8.h> +#include <camel/camel-private.h> #include <camel/camel-file-utils.h> #include <camel/camel-mime-message.h> #include <camel/camel-stream-mem.h> @@ -424,6 +425,8 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) int id, max, i; int retval; + CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock); + /* gather a list of changes to sync to the server */ sync = g_ptr_array_new (); max = camel_folder_summary_count (folder->summary); @@ -453,7 +456,7 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) g_ptr_array_free (sync, TRUE); if (retval == -1) - return; + goto done; } else { g_ptr_array_free (sync, TRUE); } @@ -481,6 +484,10 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) } camel_folder_summary_save (folder->summary); + + done: + + CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock); } static void @@ -572,6 +579,8 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex) CamelStream *stream; int id; + CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock); + ic = camel_imap4_engine_queue (engine, folder, "UID FETCH %s BODY.PEEK[]\r\n", uid); camel_imap4_command_register_untagged (ic, "FETCH", untagged_fetch); ic->user_data = stream = camel_stream_mem_new (); @@ -583,7 +592,7 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex) camel_exception_xfer (ex, &ic->ex); camel_imap4_command_unref (ic); camel_object_unref (stream); - return NULL; + goto done; } switch (ic->result) { @@ -609,6 +618,10 @@ imap4_get_message (CamelFolder *folder, const char *uid, CamelException *ex) camel_object_unref (stream); + done: + + CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock); + return message; } @@ -632,6 +645,8 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message, struct tm tm; int id, i; + CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock); + /* construct the option flags list */ if (info->flags & folder->permanent_flags) { p = g_stpcpy (flags, " ("); @@ -695,6 +710,7 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message, if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) { camel_exception_xfer (ex, &ic->ex); camel_imap4_command_unref (ic); + CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock); return; } @@ -756,6 +772,8 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message, } camel_imap4_command_unref (ic); + + CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock); } @@ -799,6 +817,8 @@ imap4_transfer_messages_to (CamelFolder *src, GPtrArray *uids, CamelFolder *dest g_ptr_array_sort (infos, (GCompareFunc) info_uid_sort); + CAMEL_SERVICE_LOCK (src->parent_store, connect_lock); + dest_namelen = strlen (camel_imap4_folder_utf7_name ((CamelIMAP4Folder *) dest)); for (i = 0; i < infos->len; i += n) { @@ -863,4 +883,6 @@ imap4_transfer_messages_to (CamelFolder *src, GPtrArray *uids, CamelFolder *dest for (i = 0; i < infos->len; i++) camel_folder_summary_info_free (src->summary, infos->pdata[i]); g_ptr_array_free (infos, TRUE); + + CAMEL_SERVICE_LOCK (src->parent_store, connect_lock); } |