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



commit 200f6ec5e4d4aa45589a381acd42651fd54cecc3
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 15 14:43:20 2010 +0200

    Bug #608766 - Replace pthread with GLib's GThread

 configure.ac                      |    4 ++--
 modules/plugin-python/Makefile.am |    2 +-
 shell/main.c                      |   12 +++++-------
 3 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7ce0f2b..da093d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,10 +899,10 @@ if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
 					[Please specify the path to libnspr4.a]
 					[Example: --with-nspr-libs=/usr/lib])
 				else
-					nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
+					nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a"
 				fi
 			else
-				nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
+				nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
 			fi
 
 			AC_CACHE_CHECK([for Mozilla nspr libraries], [ac_cv_moz_nspr_libs],
diff --git a/modules/plugin-python/Makefile.am b/modules/plugin-python/Makefile.am
index 4aaf14a..6bc2dcf 100644
--- a/modules/plugin-python/Makefile.am
+++ b/modules/plugin-python/Makefile.am
@@ -13,7 +13,7 @@ libevolution_module_plugin_python_la_SOURCES =			\
 	e-plugin-python.h
 
 libevolution_module_plugin_python_la_LIBADD =			\
-	-lpthread -ldl -lutil -lm				\
+	-ldl -lutil -lm						\
 	$(top_builddir)/e-util/libeutil.la			\
 	$(E_UTIL_LIBS)						\
 	$(PY_LIBS)
diff --git a/shell/main.c b/shell/main.c
index c36afc6..eba992e 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -251,18 +251,16 @@ idle_cb (gchar **uris)
 
 static void (*gnome_segv_handler) (gint);
 static GStaticMutex segv_mutex = G_STATIC_MUTEX_INIT;
-static pthread_t main_thread;
+static GThread *main_thread = NULL;
 
 static void
 segv_redirect (gint sig)
 {
-	if (pthread_self () == main_thread)
-		gnome_segv_handler (sig);
-	else {
-		pthread_kill (main_thread, sig);
+	gnome_segv_handler (sig);
 
+	if (g_thread_self () != main_thread) {
 		/* We can't return from the signal handler or the thread may
-		   SEGV again. But we can't pthread_exit, because then the
+		   SEGV again. But we can't g_thread_exit, because then the
 		   thread may get cleaned up before bug-buddy can get a stack
 		   trace. So we block by trying to lock a mutex we know is
 		   already locked.  */
@@ -279,7 +277,7 @@ setup_segv_redirect (void)
 	if (osa.sa_handler == SIG_DFL)
 		return;
 
-	main_thread = pthread_self ();
+	main_thread = g_thread_self ();
 
 	sa.sa_flags = 0;
 	sigemptyset (&sa.sa_mask);



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