[evolution-exchange] Bug #608766 - Replace pthread with GLib's GThread



commit df8e5378ff870de1b3428d51856f7f36c50b4e77
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 15 14:46:02 2010 +0200

    Bug #608766 - Replace pthread with GLib's GThread

 addressbook/Makefile.am                       |    1 -
 addressbook/e-book-backend-exchange-factory.c |    1 -
 calendar/Makefile.am                          |    3 +--
 calendar/e-cal-backend-exchange-factory.c     |    1 -
 camel/Makefile.am                             |    3 +--
 configure.ac                                  |    5 -----
 eplugin/Makefile.am                           |    1 -
 m4/evo_pthread_check.m4                       |   16 ----------------
 server/lib/actest.c                           |    5 ++---
 server/lib/e2k-global-catalog.c               |   12 ++++++++----
 server/lib/ebrowse.c                          |    7 ++++---
 server/lib/gctest.c                           |    6 +++---
 tools/Makefile.am                             |    1 -
 13 files changed, 19 insertions(+), 43 deletions(-)
---
diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am
index 4e52854..0568f75 100644
--- a/addressbook/Makefile.am
+++ b/addressbook/Makefile.am
@@ -60,7 +60,6 @@ libebookbackendexchange_la_LIBADD = \
 	$(top_builddir)/tools/libevolution-exchange-shared.la \
 	$(EVOLUTION_DATA_SERVER_LIBS) \
 	$(EVOLUTION_PLUGIN_LIBS) \
-	$(PTHREAD_LIB) \
 	$(DNS_LIBS)
 
 if HAVE_LIBDB
diff --git a/addressbook/e-book-backend-exchange-factory.c b/addressbook/e-book-backend-exchange-factory.c
index 8a22ad1..2f1eda3 100644
--- a/addressbook/e-book-backend-exchange-factory.c
+++ b/addressbook/e-book-backend-exchange-factory.c
@@ -21,7 +21,6 @@
 #include <config.h>
 #endif
 
-#include <pthread.h>
 #include <string.h>
 
 #include <camel/camel.h>
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 1c5d03c..4763891 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -33,7 +33,6 @@ libecalbackendexchange_la_LIBADD = \
 	$(EVOLUTION_DATA_SERVER_LIBS) \
 	$(EVOLUTION_PLUGIN_LIBS) \
 	$(LDAP_LIBS) \
-	$(DNS_LIBS) \
-	$(PTHREAD_LIB)
+	$(DNS_LIBS)
 
 -include $(top_srcdir)/git.mk
diff --git a/calendar/e-cal-backend-exchange-factory.c b/calendar/e-cal-backend-exchange-factory.c
index c4c06be..cd4a31c 100644
--- a/calendar/e-cal-backend-exchange-factory.c
+++ b/calendar/e-cal-backend-exchange-factory.c
@@ -21,7 +21,6 @@
 #include <config.h>
 #endif
 
-#include <pthread.h>
 #include <string.h>
 
 #include <camel/camel.h>
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 7efc7a0..e65578b 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -44,8 +44,7 @@ libcamelexchange_la_LIBADD = \
 	$(EVOLUTION_PLUGIN_LIBS) \
 	$(LDAP_LIBS) \
 	$(SOCKET_LIBS) \
-	$(DNS_LIBS) \
-	$(PTHREAD_LIB)
+	$(DNS_LIBS)
 
 EXTRA_DIST = libcamelexchange.urls
 
diff --git a/configure.ac b/configure.ac
index 5286515..ee19c12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -263,11 +263,6 @@ AC_DEFINE_UNQUOTED([E2K_APPROX_BUILD_TIME],[$abt],[Used to prevent clock-setting
 
 AC_DEFINE([HANDLE_LIBICAL_MEMORY],[1],[Define it once memory returned by libical is free'ed properly])
 
-dnl *************
-dnl pthread check
-dnl *************
-EVO_PTHREAD_CHECK
-
 dnl **************
 dnl libdb checking
 dnl **************
diff --git a/eplugin/Makefile.am b/eplugin/Makefile.am
index 4f710d7..9eb8747 100644
--- a/eplugin/Makefile.am
+++ b/eplugin/Makefile.am
@@ -64,7 +64,6 @@ liborg_gnome_exchange_operations_la_LIBADD = \
 	$(EVOLUTION_PLUGIN_LIBS) \
 	$(EVOLUTION_SHELL_LIBS) \
 	$(EVOLUTION_MAIL_LIBS) \
-	$(PTHREAD_LIB) \
 	$(DNS_LIBS)
 
 liborg_gnome_exchange_operations_la_LDFLAGS = \
diff --git a/server/lib/actest.c b/server/lib/actest.c
index 31d076a..0fdc4c7 100644
--- a/server/lib/actest.c
+++ b/server/lib/actest.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -45,10 +44,10 @@ cancel (gpointer data)
 static void
 quit (gint sig)
 {
-	static pthread_t cancel_thread;
+	static GThread *cancel_thread = NULL;
 
 	if (!cancel_thread) {
-		pthread_create (&cancel_thread, NULL, cancel, NULL);
+		cancel_thread = g_thread_create (cancel, NULL, FALSE, NULL);
 	} else
 		exit (0);
 }
diff --git a/server/lib/e2k-global-catalog.c b/server/lib/e2k-global-catalog.c
index 73cb349..c94d55b 100644
--- a/server/lib/e2k-global-catalog.c
+++ b/server/lib/e2k-global-catalog.c
@@ -25,11 +25,12 @@
 #include "e2k-sid.h"
 #include "e2k-utils.h"
 
-#include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
 
+#include <glib.h>
+
 #ifdef HAVE_LDAP_NTLM_BIND
 #include "xntlm.h"
 #endif
@@ -936,7 +937,8 @@ e2k_global_catalog_async_lookup (E2kGlobalCatalog *gc,
 				 gpointer user_data)
 {
 	struct async_lookup_data *ald;
-	pthread_t pth;
+	GThread *thread;
+	GError *error = NULL;
 
 	ald = g_new0 (struct async_lookup_data, 1);
 	ald->gc = g_object_ref (gc);
@@ -947,8 +949,10 @@ e2k_global_catalog_async_lookup (E2kGlobalCatalog *gc,
 	ald->callback = callback;
 	ald->user_data = user_data;
 
-	if (pthread_create (&pth, NULL, do_lookup_thread, ald) == -1) {
-		g_warning ("Could not create lookup thread\n");
+	if ((thread = g_thread_create (do_lookup_thread, ald, FALSE, &error)) == NULL) {
+		g_warning ("%s: Could not create lookup thread: %s", G_STRFUNC, error ? error->message : "Unknown error");
+		if (error)
+			g_error_free (error);
 		ald->status = E2K_GLOBAL_CATALOG_ERROR;
 		g_idle_add (idle_lookup_result, ald);
 	}
diff --git a/server/lib/ebrowse.c b/server/lib/ebrowse.c
index 26d4f2c..1a469ee 100644
--- a/server/lib/ebrowse.c
+++ b/server/lib/ebrowse.c
@@ -26,7 +26,6 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -36,6 +35,8 @@
 
 #include <libsoup/soup-misc.h>
 
+#include <glib.h>
+
 #include "e2k-context.h"
 #include "e2k-restriction.h"
 #include "e2k-security-descriptor.h"
@@ -612,13 +613,13 @@ cancel (gpointer op)
 static void
 quit (gint sig)
 {
-	static pthread_t cancel_thread;
+	static GThread *cancel_thread = NULL;
 
 	/* Can't cancel from here because we might be
 	 * inside a malloc.
 	 */
 	if (!cancel_thread) {
-		pthread_create (&cancel_thread, NULL, cancel, &op);
+		cancel_thread = g_thread_create (cancel, &op, FALSE, NULL);
 	} else
 		exit (0);
 }
diff --git a/server/lib/gctest.c b/server/lib/gctest.c
index c3c80df..c4f8eaa 100644
--- a/server/lib/gctest.c
+++ b/server/lib/gctest.c
@@ -23,11 +23,11 @@
 #include <config.h>
 #endif
 
-#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <glib.h>
 
 #include "e2k-global-catalog.h"
 #include "e2k-sid.h"
@@ -215,10 +215,10 @@ cancel (gpointer data)
 static void
 quit (gint sig)
 {
-	static pthread_t cancel_thread;
+	static GThread *cancel_thread = NULL;
 
 	if (!cancel_thread) {
-		pthread_create (&cancel_thread, NULL, cancel, NULL);
+		cancel_thread = g_thread_create (cancel, NULL, FALSE, NULL);
 	} else
 		exit (0);
 }
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 9d9e6d7..5ce2253 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -67,7 +67,6 @@ exchange_connector_setup_LDADD = \
 	$(GNOME_PLATFORM_LIBS) \
 	$(EVOLUTION_DATA_SERVER_LIBS) \
 	$(EVOLUTION_PLUGIN_LIBS) \
-	$(PTHREAD_LIB) \
 	$(LDAP_LIBS)\
 	$(DNS_LIBS)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]