[Xcb] [libpthread-stubs] fix semaphore signal safety

Jamey Sharp jamey at minilop.net
Sat Sep 26 08:59:14 PDT 2009


On Sat, Sep 26, 2009 at 6:52 AM, Samuel Thibault
<samuel.thibault at ens-lyon.org> wrote:
> I've just realized that sem_post() is allowed to be called from a signal
> handler, so the semaphore implementation has to be signal-safe, here is
> a patch.

Huh, I missed something when the original patches went by. Why do
these stubs need to do anything? pthread_mutex_lock, for instance, is
a complete no-op.

Is this because "The mutex functions are not async-signal safe"
(pthread_mutex_lock(3)) so can't possibly be used in a single-threaded
program, but the semaphore functions apparently can?

Still, it seems to me that if somebody expects the semaphore functions
to actually do something, they should link with pthread.

Jamey


More information about the Xcb mailing list