[Xcb] Bug#496715: libpthread-stubs: Should provide more pthread_* functions

Rémi Denis-Courmont remi at remlab.net
Tue Oct 13 01:14:46 PDT 2009


On Mon, 12 Oct 2009 22:15:59 +0200, Ulrich Eckhardt <doomster at knuut.de>
wrote:
> Alternative suggestion: If pthread_cond_init() is implemented in the
stubs
> to return "okay", then I could imagine pthread_cond_[timed]wait() to also
> work in some way.

The return value of pthread_cond_init is commonly ignored. In fact, I
believe pthread_cond_init cannot fail on Linux (it really only initializes
memory). Conversely, the pthread_cond_init() error paths, if they exist,
are likely totally untested and buggy. Hence, I think returning an error
from pthread_cond_init() is a bad idea.

> Otherwise, if the former already signals an error, using a condition
> variable that wasn't even successfully initialized can well abort or
> misbehave in any other way it likes.

Well, a simple timer for _timedwait() and an infinite sleep for _wait()
would make more sense here. Of course, that requires a portable way to
sleep (e.g. nanosleep() and pause()).

-- 
Rémi Denis-Courmont



More information about the Xcb mailing list