Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Oct 1998 11:19:01 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        eischen@vigrid.com, lists@tar.com
Cc:        current@FreeBSD.ORG
Subject:   Re: Another Serious libc_r problem
Message-ID:  <199810211519.LAA07958@pcnet1.pcnet.com>

next in thread | raw e-mail | index | archive | help
> >If the thread doesn't own the mutex, then you've got the
> >condition variable locked while you're waiting for the
> >pthread_mutex_unlock().  Since this falls into the category
> >of "undefined behavior" it probably doesn't matter though.
>
> However, the thread should own the mutex shouldn't it?  I thought
> the spec for pthread_cond_wait says it should return EINVAL if
> the thread doesn't own the mutex?  However, its not clear to
> me that our pthread_cond_wait code makes this check (I think
> it doesn't).

Yeah, we're saying the same thing.  The thread *should* own
the mutex, and then your solution works.  If it doesn't own
the mutex, then you've got a potential deadlock condition,
but this could be deemed acceptable because POSIX says that
"undefined behavior" will occur in this case.

I don't have the POSIX spec handy, but I think you're right in
that pthread_cond_wait should return EINVAL if the thread
doesn't own the mutex.

Dan Eischen
eischen@vigrid.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810211519.LAA07958>