tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Q about pthread condition variable usage - mixing interlocks




> On Apr 8, 2021, at 11:15 AM, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> 
>> Is there ANY situation where, for a given pthread condition variable, that u$
> 
> For what value of "legitimate"?
> 
> I see no reason why this would/should be forbidden, and, indeed, at
> least the 5.2 manpage for pthread_cond_wait seems to imply that it is
> permitted, provided the condvar is idle:

Ah, yes, I should clarify, I am speaking about only when the condition variable is NOT idle.  And now that I read IEEE Std 1003.1-2017 again, I see:

“””
During this time, the effect of an attempt by any thread to wait on that condition variable using a different mutex is undefined.
“””

I.e. I was wrong that there was language missing from the spec.  I’ll save myself some work and, rather than attempt to gracefully handle this sort of thing, I’ll just return EPERM when the situation is detected.

Thanks, folks.

-- thorpej



Home | Main Index | Thread Index | Old Index