Andreas Pflug pgadmin
Sun Mar 20 20:28:45 PST 2005
I got some minutes to test CVS HEAD under win32 mingw, and the result is 
unfortunately a regression from what 1.05 gives.

./configure will fail because it checks for sigaction, which is used in 
slon.c for SIGHUP handling. win32 doesn't provide sigaction(), only 
signal() which is probably sufficient for win32 anyway. Maybe configure 
can implement a fallback to signal() if sigaction() isn't present?

After this configure error, I don't get Makefiles so I couldn't execute 
more tests. Still, I have some information to share.

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.

The backend/xxid makefiles I provided some time ago (now located in the 
Win32 subdirectory) were meant as portable replacement for the current 
versions for *all* platforms, not only mingw. They don't need 
./configure to be created (just as typical pgsql/contrib makefiles). 
They work successfully on Linux, and I would expect them to do so on any 
pgsql supported platform.

Regards,
Andreas

-------------- next part --------------
Index: src/slon/scheduler.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.19
diff -u -r1.19 scheduler.c
--- src/slon/scheduler.c	10 Mar 2005 23:11:26 -0000	1.19
+++ src/slon/scheduler.c	20 Mar 2005 20:10:13 -0000
@@ -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: src/slon/slon.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
retrieving revision 1.47
diff -u -r1.47 slon.c
--- src/slon/slon.c	17 Mar 2005 22:54:23 -0000	1.47
+++ src/slon/slon.c	20 Mar 2005 20:10:15 -0000
@@ -732,7 +732,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-general mailing list