Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit95178c8

Browse files
committed
Report error if thread-test is run without having threading enabled in
configure.
1 parent66b42d3 commit95178c8

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎src/tools/thread/thread_test.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
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 $
1010
*
1111
*This program tests to see if your standard libc functions use
1212
*pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -20,10 +20,10 @@
2020
*-------------------------------------------------------------------------
2121
*/
2222

23-
#include<pthread.h>
24-
#include<unistd.h>
2523
#include<stdio.h>
24+
2625
#include<stdlib.h>
26+
#include<unistd.h>
2727
#include<netdb.h>
2828
#include<sys/types.h>
2929
#include<pwd.h>
@@ -33,6 +33,20 @@
3333

3434
#include"postgres.h"
3535

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+
3650
voidfunc_call_1(void);
3751
voidfunc_call_2(void);
3852

@@ -311,3 +325,5 @@ func_call_2(void)
311325
pthread_mutex_lock(&init_mutex);/* wait for parent to test */
312326
pthread_mutex_unlock(&init_mutex);
313327
}
328+
#endif/* !ENABLE_THREAD_SAFETY */
329+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp