[vlc-devel] [PATCH] darwin/thread: Ignore vlc_mutex_unlock failures
remi at remlab.net
Mon Dec 2 18:20:50 CET 2019
Le maanantaina 2. joulukuuta 2019, 15.03.30 EET Thomas Guillem a écrit :
> On Tue, Oct 29, 2019, at 14:28, Alexandre Janniaux wrote:
> > Hi,
> > I agree for the need of a smart and better fix.
> > In the mean time, it might make sense to include this fix
> > in any case as it seems that it's either no assertion at
> > all or this assertion removed ?
> I agree with Alexandre,
This is not a fix.
Unlocking a mutex that is not locked is UB, and that's not just in theory.
Handling this error case safely requires making such a pessimist
implementation of pthread_mutex_unlock() that complexity and performance will
be measurably worse, so real-life implementations don't handle this really
safely. It's one of those cases of 99% harmless EINVAL error return and 1%
horrible unreproducible crash.
And the worst of all is, this patch does not even work-around the bug that it
claims to - that pthread_cond_wait() fails to lock the mutex.
More information about the vlc-devel