[MPlayer-dev-eng] [PATCH] Fix dead lock in ao_macosx when switch stream format.

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Nov 7 15:05:36 CET 2007


Hello,
On Wed, Nov 07, 2007 at 09:00:18PM +0800, Ulion wrote:
> 2007/11/7, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
[...]
> > So removing the lock in the callback means that the signal can be
> > completely missed (due to the main thread being somewhere in the code
> > before or in-between pthread_cond_timedwait), so the worst-case
> > behaviour would be like just removing the callback completely, and
> > changes in the system scheduler could make that worst case quite likely.
> >
> 
> OK, I got a no lock version of fix now, it also works fine without
> problems, please check it.

If it ever doesn't print "reached timeout" your compiler is very stupid.
IOW this is completely broken and you could just remove the whole
callback stuff instead.
This is exactly why writing lockless code comes after fully
understanding how to use locks correctly, fully understanding how the
CPU you work with works and realizing that it's pure luck if it works at
all without any asm code.
If it still worse that sure raises the question wtf all that code is
supposed to be good for if it works with over half of it disabled.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list