summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian2004-04-27 19:51:12 +0000
committerBruce Momjian2004-04-27 19:51:12 +0000
commite27338f26c87dd2f01999d5d27d1a44b815285ad (patch)
treef63577a0fbd596c7e3f5471f5087aca7d25d83df /src
parentca8a8baa76e6c994146f65a340f3fec2b08bf3f3 (diff)
Do thread testing from configure in a much cleaner fashion.
Diffstat (limited to 'src')
-rw-r--r--src/tools/thread/thread_test.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/tools/thread/thread_test.c b/src/tools/thread/thread_test.c
index 37b3200c136..f0b7d62e4fb 100644
--- a/src/tools/thread/thread_test.c
+++ b/src/tools/thread/thread_test.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.28 2004/04/27 18:40:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.29 2004/04/27 19:51:12 momjian Exp $
*
* This program tests to see if your standard libc functions use
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -20,7 +20,22 @@
*-------------------------------------------------------------------------
*/
+#ifndef IN_CONFIGURE
#include "postgres.h"
+#else
+/* From src/include/c.h" */
+#ifndef bool
+typedef char bool;
+#endif
+
+#ifndef true
+#define true ((bool) 1)
+#endif
+
+#ifndef false
+#define false ((bool) 0)
+#endif
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -32,7 +47,7 @@
#include <fcntl.h>
#include <errno.h>
-#ifndef ENABLE_THREAD_SAFETY
+#if !defined(ENABLE_THREAD_SAFETY) && !defined(IN_CONFIGURE)
int
main(int argc, char *argv[])
{
@@ -96,6 +111,12 @@ main(int argc, char *argv[])
return 1;
}
+#ifdef IN_CONFIGURE
+ /* Send stdout to 'config.log' */
+ close(1);
+ dup(5);
+#endif
+
/* Make temp filenames, might not have strdup() */
temp_filename_1 = malloc(strlen(TEMP_FILENAME_1) + 1);
strcpy(temp_filename_1, TEMP_FILENAME_1);
@@ -339,5 +360,4 @@ func_call_2(void)
pthread_mutex_lock(&init_mutex); /* wait for parent to test */
pthread_mutex_unlock(&init_mutex);
}
-#endif /* !ENABLE_THREAD_SAFETY */
-
+#endif /* !ENABLE_THREAD_SAFETY && !IN_CONFIGURE */