mirror of
https://github.com/postgres/postgres.git
synced 2025-05-09 18:21:05 +03:00
Report error if thread-test is run without having threading enabled in
configure.
This commit is contained in:
parent
66b42d3028
commit
95178c8d24
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.21 2004/04/23 20:35:50 momjian Exp $
|
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.22 2004/04/23 22:21:49 momjian Exp $
|
||||||
*
|
*
|
||||||
* This program tests to see if your standard libc functions use
|
* This program tests to see if your standard libc functions use
|
||||||
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
|
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
|
||||||
@ -20,10 +20,10 @@
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@ -33,6 +33,20 @@
|
|||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#ifndef ENABLE_THREAD_SAFETY
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
fprintf(stderr, "This PostgreSQL build does not support threads.\n");
|
||||||
|
fprintf(stderr, "Perhaps rerun 'configure' using '--enable-thread-safety'.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* This must be down here because this is the code that uses threads. */
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
void func_call_1(void);
|
void func_call_1(void);
|
||||||
void func_call_2(void);
|
void func_call_2(void);
|
||||||
|
|
||||||
@ -311,3 +325,5 @@ func_call_2(void)
|
|||||||
pthread_mutex_lock(&init_mutex); /* wait for parent to test */
|
pthread_mutex_lock(&init_mutex); /* wait for parent to test */
|
||||||
pthread_mutex_unlock(&init_mutex);
|
pthread_mutex_unlock(&init_mutex);
|
||||||
}
|
}
|
||||||
|
#endif /* !ENABLE_THREAD_SAFETY */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user