[Date Prev][Date Next]
RE: Multi-threaded slapd on AIX 4.2.1
At 06:56 PM 4/9/00 -0700, Howard Chu wrote:
>> -----Original Message-----
>> From: Kurt D. Zeilenga [mailto:Kurt@OpenLDAP.org]
>> At 12:29 AM 4/8/00 -0700, Howard Chu wrote:
>> >None of the AIX documentation even mentions the pthread_detach()
>> >although it is present in pthread.h and in the library. At this point, my
>> >configure is complaining that pthread_create() is incompatible,
>> because the
>> >test program gets an ESRCH returned from pthread_detach().
>> ESRCH implies a D4 vs final mismatch between the header and the library.
>> >Got any ideas how to modify this particular test?
>> Does pthread.h have multiple pthread_*() prototypes? conditional
>> (-D) on what?
>> Does AIX have multiple pthread libraries? conditional (-l) on what?
>Well, it has both a pthreads library and a dcepthreads library for DCE, but
>I'm definitely not trying to use the DCE stuff.
Just for clarification, DCE is Pthreads Draft 4. Is pthread.h you are
using for DCE pthreads or POSIX threads? Is there a conditional to get
>The pthread_detach() returns
>ESRCH because the thread was already detached,
Odd, my pthread_detach() man page calling pthread_detach with
an invalid pthread handle should return ESRCH and calling with
a non-joinable thread should return EINVAL.
>since AIX 4.2's
>pthread_create creates detached threads by default.
AIX is broken. pthread_create() should create joinable threads by
What happens if you create a thread and then attempt to call
pthread_join() on it?
What happens if you use DCE pthreads instead?
>Just for the sake of
>getting thru the configure script, I added a "#define HAVE_AIX_THREADS 1" to
>confdefs.h and added a check for it in the test. If true, I do a
>PTHREAD_CREATE_UNDETACHED, so the newly created thread can be
I would suggest we detect (configure) this case by using:
with verification by
We can also define PTHREAD_CREATE_JOINABLE to PTHREAD_CREATE_UNDETACHED
when PTHREAD_CREATE_JOINABLE is missing.
>In libldap_r/thr_posix.c, I decided to base the check on
>#if defined(HAVE_PTHREADS_FINAL) && defined(PTHREAD_CREATE_UNDETACHED)
>and do a similar pthread_attr_setdetachstate() to fix things. (AIX 4.2
>know about the PTHREAD_CREATE_JOINABLE flag but otherwise claims to be
I would prefer the HAVE_PTHREADS_FINAL and NEEDS... be defined if
pthread_attr_setdetachstate(). Basic flow:
/* POSIX Threads */
/* AIX threads are broken... threads are not joinable by default */
/* DCE/D4 Pthreads