CVS User Account cvsuser
Wed Mar 23 23:06:53 PST 2005
Log Message:
-----------
>From Andreas Pflug <pgadmin at pse-consulting.de>:

In schedule.c and slon.c, pthread_self() result is compared with a 
pthread_t variable, which isn't the recommended way to check for 
equality; instead pthread_equal should be used. Under win32 this fails, 
because pthread_t isn't a simple value. The attached file provides a 
patch for this, and should make this portable for all pthread_t platforms.

Modified Files:
--------------
    slony1-engine/src/slon:
        slon.c (r1.48 -> r1.49)
        scheduler.c (r1.19 -> r1.20)

-------------- next part --------------
Index: scheduler.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lsrc/slon/scheduler.c -Lsrc/slon/scheduler.c -u -w -r1.19 -r1.20
--- src/slon/scheduler.c
+++ src/slon/scheduler.c
@@ -655,7 +655,7 @@
 	 * Lock the master mutex and make sure that we are the main thread
 	 */
 	pthread_mutex_lock(&sched_master_lock);
-	if (pthread_self() != sched_main_thread)
+	if (!pthread_equal(pthread_self(), sched_main_thread))
 	{
 		slon_log(SLON_FATAL, "sched_sighandler: called in non-main thread\n");
 		slon_abort();
Index: slon.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -Lsrc/slon/slon.c -Lsrc/slon/slon.c -u -w -r1.48 -r1.49
--- src/slon/slon.c
+++ src/slon/slon.c
@@ -739,7 +739,7 @@
 static void
 main_sigalrmhandler(int signo)
 {
-	if (main_thread == pthread_self())
+	if (pthread_equal(main_thread, pthread_self()))
 	{
 		alarm(0);
 		slon_log(SLON_WARN, "main: shutdown timeout exiting\n");


More information about the Slony1-commit mailing list