|
6 | 6 | * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
7 | 7 | * Portions Copyright (c) 1994, Regents of the University of California
|
8 | 8 | *
|
9 |
| - *$PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.21 2004/04/2320:35:50 momjian Exp $ |
| 9 | + *$PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.22 2004/04/2322:21:49 momjian Exp $ |
10 | 10 | *
|
11 | 11 | *This program tests to see if your standard libc functions use
|
12 | 12 | *pthread_setspecific()/pthread_getspecific() to be thread-safe.
|
|
20 | 20 | *-------------------------------------------------------------------------
|
21 | 21 | */
|
22 | 22 |
|
23 |
| -#include<pthread.h> |
24 |
| -#include<unistd.h> |
25 | 23 | #include<stdio.h>
|
| 24 | + |
26 | 25 | #include<stdlib.h>
|
| 26 | +#include<unistd.h> |
27 | 27 | #include<netdb.h>
|
28 | 28 | #include<sys/types.h>
|
29 | 29 | #include<pwd.h>
|
|
33 | 33 |
|
34 | 34 | #include"postgres.h"
|
35 | 35 |
|
| 36 | +#ifndefENABLE_THREAD_SAFETY |
| 37 | +int |
| 38 | +main(intargc,char*argv[]) |
| 39 | +{ |
| 40 | +fprintf(stderr,"This PostgreSQL build does not support threads.\n"); |
| 41 | +fprintf(stderr,"Perhaps rerun 'configure' using '--enable-thread-safety'.\n"); |
| 42 | +return1; |
| 43 | +} |
| 44 | + |
| 45 | +#else |
| 46 | + |
| 47 | +/* This must be down here because this is the code that uses threads. */ |
| 48 | +#include"pthread.h" |
| 49 | + |
36 | 50 | voidfunc_call_1(void);
|
37 | 51 | voidfunc_call_2(void);
|
38 | 52 |
|
@@ -311,3 +325,5 @@ func_call_2(void)
|
311 | 325 | pthread_mutex_lock(&init_mutex);/* wait for parent to test */
|
312 | 326 | pthread_mutex_unlock(&init_mutex);
|
313 | 327 | }
|
| 328 | +#endif/* !ENABLE_THREAD_SAFETY */ |
| 329 | + |