Commit d56b736d authored by Bruce Momjian's avatar Bruce Momjian

Update thread test to do getpid() in while loop, also use weather.com

rather than slashdot.org for testing.
parent 8efbe30d
...@@ -6,7 +6,7 @@ ...@@ -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.9 2004/03/28 02:37:31 momjian Exp $ * $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.10 2004/04/04 17:23:54 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.
...@@ -105,7 +105,7 @@ void func_call_1(void) { ...@@ -105,7 +105,7 @@ void func_call_1(void) {
/* wait for other thread to set errno */ /* wait for other thread to set errno */
errno1_set = 1; errno1_set = 1;
while (errno2_set == 0) while (errno2_set == 0)
/* loop */; getpid(); /* force system call */
if (errno != EEXIST) if (errno != EEXIST)
{ {
fprintf(stderr, "errno not thread-safe; exiting\n"); fprintf(stderr, "errno not thread-safe; exiting\n");
...@@ -128,8 +128,8 @@ void func_call_1(void) { ...@@ -128,8 +128,8 @@ void func_call_1(void) {
passwd_p1 = NULL; /* force thread-safe failure report */ passwd_p1 = NULL; /* force thread-safe failure report */
} }
hostent_p1 = gethostbyname("yahoo.com"); hostent_p1 = gethostbyname("www.yahoo.com");
p = gethostbyname("slashdot.org"); p = gethostbyname("www.weather.com");
if (hostent_p1 != p) if (hostent_p1 != p)
{ {
printf("Your gethostbyname() changes the static memory area between calls\n"); printf("Your gethostbyname() changes the static memory area between calls\n");
...@@ -151,7 +151,7 @@ void func_call_2(void) { ...@@ -151,7 +151,7 @@ void func_call_2(void) {
/* wait for other thread to set errno */ /* wait for other thread to set errno */
errno2_set = 1; errno2_set = 1;
while (errno1_set == 0) while (errno1_set == 0)
/* loop */; getpid(); /* force system call */
if (errno != ENOENT) if (errno != ENOENT)
{ {
fprintf(stderr, "errno not thread-safe; exiting\n"); fprintf(stderr, "errno not thread-safe; exiting\n");
...@@ -174,8 +174,8 @@ void func_call_2(void) { ...@@ -174,8 +174,8 @@ void func_call_2(void) {
passwd_p2 = NULL; /* force thread-safe failure report */ passwd_p2 = NULL; /* force thread-safe failure report */
} }
hostent_p2 = gethostbyname("google.com"); hostent_p2 = gethostbyname("www.google.com");
p = gethostbyname("postgresql.org"); p = gethostbyname("www.postgresql.org");
if (hostent_p2 != p) if (hostent_p2 != p)
{ {
printf("Your gethostbyname() changes the static memory area between calls\n"); printf("Your gethostbyname() changes the static memory area between calls\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment