wespvp@syntegra.com wrote: > On 4/4/04 7:28 PM, "Bruce Momjian" <pgman@candle.pha.pa.us> wrote: > > > OK, I know the cause of this. The problem is that sometimes hostnames > > don't resolve, and the bigger problem is that it requires an internet > > connection to run the tests. The attached patch tests for 'localhost' > > and your local hostname, so it should work reliably. > > I did a cvs update, make, then rebuilt and tested thread_test. I ran it > about 120 times and got "GETHOSTBYNAME_THREADSAFE=yes" almost all of the > time. I got "GETHOSTBYNAME_THREADSAFE=no" three times. The other two were > always "yes". Yep, I can reproduce this on BSD/OS too, so it must be something wrong with my program. I see: $ for X in `jot 1000`; do thread_test |grep -10 '=no' && echo $X; done|less Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS' defines to your template/$port file before compiling this program. Add this to your template/$port file: STRERROR_THREADSAFE=yes GETPWUID_THREADSAFE=no GETHOSTBYNAME_THREADSAFE=no 919 I bet the problem is that I am accessing thread-specific pointers after the thread exits. It is possible thread 1 completes before thread2 gets to the getpwuid and gethostbyname tests, and then reuses the thread-specific pointer. Let me work on a patch and email it to you in a few minutes. > I did verify that both the "volatile" and "localhost" changes were in there. > > Dumb question... Why would you not always use the _r functions if they > exist? Yes, we do use *_r functions in 7.5 if they exist, but in 7.4.X, I think we use the non-R if we can, though we actually just use getaddrinfo() in 7.4.X if it exists. Basically, the threading tests are still in flux, as you can see, in 7.4.X. It works, but it isn't 100% configure perfect yet. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend