[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Same old AIX problem



At 11:53 AM 8/23/99 +0200, Frédéric Poels wrote:
>Here's what happens:
>...
>-> HAVE_PTHREADS_D4 is not defined
>status = pthread_create(&t, NULL, task, NULL);
>-> OK status is 0 but as a default, threads are created DETACHED on AIX (!!!)
>...
>-> HAVE_PTHREADS_D4 is not defined
>status = pthread_create(&t, NULL, task, NULL);

s/create/detach/, I assume.

>-> KAWABUNGA! status is 3!

>Here's the code that should be used instead (I think it's more portable
>even on <beeeeeep> OS'es like AIX):

It's not portable.   Draft4 pthreads doesn't even define
a detached-state attribute nor have any mechanism to create
a thread in a detached state.  pthread_detach() must be used
on these systems.

One should also note that mucking with thread attributes is
quite problematic.  We'd have to detect if pthread_attr_setdetachstate
exists and, if so, how to call it.  We'd also have to detect if
pthread_attr_delete or pthread_attr_destroy should be called.
To make matters worse, the syntax of may calls which accept
thread attributes differ from draft to draft (ie: implementation
to implementation).

Kurt