bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGSEGV on recursive pthread_join


From: Richard Guenther
Subject: Re: SIGSEGV on recursive pthread_join
Date: Thu, 8 Jan 2004 14:30:45 +0100 (CET)

On Thu, 8 Jan 2004, Andreas Schwab wrote:

> Richard Guenther <address@hidden> writes:
>
> > On Wed, 7 Jan 2004, Jeroen Dekkers wrote:
> >
> >> Looking at the code i think it should return EINVAL, I have no idea
> >> why it doesn't. But POSIX says that joining a thread twice results in
> >> undefined behaviour, so it's not really wrong to crash, just not very
> >> friendly.
> >
> > Indeed.  And somehow it "works" when using a libc with debugging symbols
> > in...
>
> That's a perfectly adequate implementation for undefined behaviour.

Of course, I'm just curious if this undefined behavior isn't a bug in
libc.  I certainly liked the previous "undefined" behavior more, which was
to return an error with !NPTL.  Also trying to debug the problem with
using a debugging enabled libc making the problem going away is also not
very helpful, but certainly undefined, too ;)

Ah, well, my problem is solved, so I'll stop arguing.

Oh, my "current" manpage for pthread_join says:

 "At most one thread can wait for the termination  of  a  given  thread.
  Calling pthread_join on a thread th on which another thread is already
  waiting for termination returns an error."

which does not say anything about undefined behavior, so, if glibc is the
source for this manpage, one should make sure the current version is
up-to-date with the current behavior.

Also, SUS says

 "The results of multiple simultaneous calls to pthread_join() specifying
  the same target thread are undefined."
 [http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_join.html]

which talks about simultaneous pthread_join(), not about a join to a
previously joined thread to which the errors EINVAL or ESRCH would be
appropriate.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]