In article <63f5d53a-2767-48f2-b7fa-fbfe93f63...@me.com>,
Jason Thorpe  <thor...@me.com> wrote:
>As far as I can tell, POSIX has no language that covers this situation,
>so I’m tossing it out here for the hive mind...
>
>Is there ANY situation where, for a given pthread condition variable,
>that using a different mutex as the interlock in two different calls to
>pthread_cond_wait() would EVER be legitimate usage?  I cannot come up
>with any scenario in which this would be appropriate, but who knows what
>some crazy applications might do.
>
>POSIX for whatever dumb reason allows pthread_cond_signal() /
>pthread_cond_broadcast() without holding the interlock, but at least
>there’s explicit language about this in the spec (and thankfully the
>language contains a mild finger-wag about it).  But as I said, the spec
>is silent on this particular question, and hopefully it’s because the
>answer is “NO THAT IS A COMPLETELY STUPID THING TO DO AND ANY SELF
>RESPECTING THREAD LIBRARY WILL IMMEDIATELY CAST YOUR APPLICATION INTO
>THE NINTH CIRCLE OF HELL IF YOU TRY IT”.
>
>What say you, smart people?
>
>Merci d’avance.

We should at least add language in our manual pages explaining that
holding the mutex - while not required - is highly desired, and will
make things work reliably. Currently I don't see anything mentioning
the mutex in our man pages (the opengroup ones do mention it).

christos

Reply via email to