Bruce Momjian wrote:
> > 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.
OK, new patch applied that causes all threads to wait until the parent
checks their thread-specific pointers. I ran 1000 tests and all passed.
Hopefully it will good for you too.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073