Re: sem_post() does not signal waiting threads

"Dr. Uwe Girlich" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>
Hello!

On Fri, Aug 30, 2002 at 03:20:08PM +0200, [email protected] wrote:
> Am Freitag den, 30. August 2002, um 11:33, schrieb Dr. Uwe Girlich:
> >
> > On Fri, Aug 30, 2002 at 09:56:20AM +0200, Dr. Uwe Girlich wrote:
> >> There is an error in the POSIX semaphore implementation in NGPT:
> > ...
> >> The attached patch file corrects this strange behaviour.
> > This correction corrects the behaviour of process shared semaphores.
> > Process local semaphores are still wrong. I'll look into it.
It is a problem of pthread_cond_signal(). See extra posting.

> Does your code uses sem_trywait()?
No.

> In that function the mutex is not released in every code path.
Looks really bad. Thanks for the patch.

> Another question: Is that double locking required? When all functions
> accessing the semaphore use __sem_waiting->__lock, why is
> __sem_waiting->__sem_lock needed? Just for destroying it safely?
I'm not really sure but I think one (shared or not shared) mutex alone should
be enough.

Bye, Uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.