From 2bd47d3cda52acc0beb688ffb4a8202412de5c09 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 9 Jul 2003 19:05:13 +0000 Subject: Get rid of the #ifdef ENABLE_THREADS since we no longer plan to 2003-07-09 Jeffrey Stedfast * camel-block-file.c: Get rid of the #ifdef ENABLE_THREADS since we no longer plan to support/maintain this. * camel.c: Same. * camel-certdb.c: Here too. * camel-charset-map.c: And here. * camel-cipher-context.c: " * camel-data-wrapper.c: " * camel-digest-folder.c: " * camel-exception.c: " * camel-folder.c: " * camel-folder-summary.c: " * camel-lock-client.c: " * camel-mime-utils.c: " * camel-object.c: " * camel-operation.c: " * camel-partition-table.c: " * camel-sasl-popb4smtp.c: " * camel-service.c: " * camel-session.c: " * camel-store.c: " * camel-store-summary.c: " * camel-text-index.c: " * camel-transport.c: " * camel-vee-folder.c: " * camel-tcp-stream-openssl.c: Removed pthread.h, it isn't needed. svn path=/trunk/; revision=21777 --- camel/camel-service.c | 53 ++++++++++++++------------------------------------- 1 file changed, 14 insertions(+), 39 deletions(-) (limited to 'camel/camel-service.c') diff --git a/camel/camel-service.c b/camel/camel-service.c index 7ea34d953d..ae3a36dba4 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -6,7 +6,7 @@ * Author : * Bertrand Guiheneuf * - * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com) + * Copyright 1999-2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -30,12 +30,10 @@ #include #include #include +#include #include -#ifdef ENABLE_THREADS -#include #include "e-util/e-msgport.h" -#endif #include "e-util/e-host-utils.h" @@ -93,12 +91,10 @@ static void camel_service_init (void *o, void *k) { CamelService *service = o; - + service->priv = g_malloc0(sizeof(*service->priv)); -#ifdef ENABLE_THREADS service->priv->connect_lock = e_mutex_new(E_MUTEX_REC); service->priv->connect_op_lock = e_mutex_new(E_MUTEX_SIMPLE); -#endif } static void @@ -123,10 +119,9 @@ camel_service_finalize (CamelObject *object) if (service->session) camel_object_unref (CAMEL_OBJECT (service->session)); -#ifdef ENABLE_THREADS e_mutex_destroy (service->priv->connect_lock); e_mutex_destroy (service->priv->connect_op_lock); -#endif + g_free (service->priv); } @@ -688,9 +683,7 @@ camel_service_gethost (CamelService *service, CamelException *ex) #endif struct _lookup_msg { -#ifdef ENABLE_THREADS EMsg msg; -#endif unsigned int cancelled:1; const char *name; int len; @@ -709,16 +702,13 @@ get_hostbyname(void *data) while ((info->result = e_gethostbyname_r(info->name, &info->hostbuf, info->hostbufmem, info->hostbuflen, &info->herr)) == ERANGE) { d(printf("gethostbyname fialed?\n")); -#ifdef ENABLE_THREADS pthread_testcancel(); -#endif info->hostbuflen *= 2; info->hostbufmem = g_realloc(info->hostbufmem, info->hostbuflen); } d(printf("gethostbyname ok?\n")); - -#ifdef ENABLE_THREADS + /* If we got cancelled, dont reply, just free it */ if (info->cancelled) { g_free(info->hostbufmem); @@ -726,21 +716,19 @@ get_hostbyname(void *data) } else { e_msgport_reply((EMsg *)info); } -#endif + return NULL; } struct hostent * camel_gethostbyname (const char *name, CamelException *exout) { -#ifdef ENABLE_THREADS int fdmax, status, fd, cancel_fd; -#endif struct _lookup_msg *msg; CamelException ex; - + g_return_val_if_fail(name != NULL, NULL); - + if (camel_operation_cancel_check(NULL)) { camel_exception_set (exout, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled")); return NULL; @@ -754,13 +742,10 @@ camel_gethostbyname (const char *name, CamelException *exout) msg->hostbufmem = g_malloc(msg->hostbuflen); msg->name = name; msg->result = -1; - -#ifdef ENABLE_THREADS + cancel_fd = camel_operation_cancel_fd(NULL); if (cancel_fd == -1) { -#endif get_hostbyname(msg); -#ifdef ENABLE_THREADS } else { EMsgPort *reply_port; pthread_t id; @@ -805,8 +790,7 @@ camel_gethostbyname (const char *name, CamelException *exout) } e_msgport_destroy(reply_port); } -#endif - + camel_operation_end(NULL); if (!camel_exception_is_set(&ex)) { @@ -835,27 +819,24 @@ static void * get_hostbyaddr (void *data) { struct _lookup_msg *info = data; - + while ((info->result = e_gethostbyaddr_r (info->name, info->len, info->type, &info->hostbuf, info->hostbufmem, info->hostbuflen, &info->herr)) == ERANGE) { d(printf ("gethostbyaddr fialed?\n")); -#ifdef ENABLE_THREADS pthread_testcancel (); -#endif info->hostbuflen *= 2; info->hostbufmem = g_realloc (info->hostbufmem, info->hostbuflen); } d(printf ("gethostbyaddr ok?\n")); -#ifdef ENABLE_THREADS if (info->cancelled) { g_free(info->hostbufmem); g_free(info); } else { e_msgport_reply((EMsg *)info); } -#endif + return NULL; } @@ -863,9 +844,7 @@ get_hostbyaddr (void *data) struct hostent * camel_gethostbyaddr (const char *addr, int len, int type, CamelException *exout) { -#ifdef ENABLE_THREADS int fdmax, status, fd, cancel_fd; -#endif struct _lookup_msg *msg; CamelException ex; @@ -886,13 +865,10 @@ camel_gethostbyaddr (const char *addr, int len, int type, CamelException *exout) msg->len = len; msg->type = type; msg->result = -1; - -#ifdef ENABLE_THREADS + cancel_fd = camel_operation_cancel_fd (NULL); if (cancel_fd == -1) { -#endif get_hostbyaddr (msg); -#ifdef ENABLE_THREADS } else { EMsgPort *reply_port; pthread_t id; @@ -936,10 +912,9 @@ camel_gethostbyaddr (const char *addr, int len, int type, CamelException *exout) e_msgport_destroy (reply_port); } -#endif camel_operation_end (NULL); - + if (!camel_exception_is_set(&ex)) { if (msg->result == 0) return &msg->hostbuf; -- cgit v1.2.3