[MPlayer-dev-eng] threaded cache

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Nov 27 17:29:41 CET 2011


On Sun, Nov 27, 2011 at 06:20:12PM +0200, Andrej N. Gritsenko wrote:
> On Sun, Nov 27, 2011, around 17:56, Reimar Döffinger wrote:
> >I read about everything I could find about it.
> >My conclusion is that pthread_cond_timedwait is full of race conditions,
> >even on systems that _do_ support a monotonic clock that it is
> >completely unusable if you actually need to rely on the timeout.
> >Or to write it in bold:
> >THERE IS NO WAY TO USE pthread_cond_timedwait CORRECTLY.
> 
>     Just my 5 cents.
> 
>     I don't know what exactly you've read but I use that POSIX function
> pthread_cond_timedwait() in application with multiple streams and I have
> no problems with it as time isn't main its purpose at all, only usage of
> the time flow in such function is to return from it after some period of
> time but main purpose of it is to wait for external event (such as cache
> request). In many cases it is possible to replace pthread_cond_timedwait
> with pthread_cond_wait. It's absolutely irrelevant to any realtime or
> monotonic clock is what I mean. :)

The usage here is quite opposite: It is absolutely critical it will
return within the given interval, the only purpose of the condition
is to make it return earlier.


More information about the MPlayer-dev-eng mailing list