[vlc-devel] [vlc-commits] auhal: implement drain
remi at remlab.net
Tue Mar 26 19:49:52 CET 2013
Le mardi 26 mars 2013 20:06:12, David Fuhrmann a écrit :
> If I parsed the relevant parts of your emails in the right way, I assume
> that you want to complain that I did not extended the scope of the mutex
> lock to the manipulation of the buffer.
I wouldn't put it exactly like that, but roughly yes for short.
> Please note that I already thought in doing so, before committing.
> But the CircularBuffer already has some thread safety mechanisms using
> atomic operations.
That is irrelevant. It's good that CircularBuffer has thread-safety within
itself. But that does not cover the predicate of the condition variable.
> For this scenario I assumed that these will suffice for
> proper thread synchronization.
Locking the mutex makes no sense if you don't change state. You could remove
the locking and unlocking calls to the same effect.
Then it would be obvious that scheduling predictability was missing. Hence I
strongly suspect that waiting can still deadlock with unfortunate timings.
In particular, I do not see what synchronization directive prevents the render
thread from signalling the condition variable in the short time window after
the audio thread checks the buffer tial but before it starts waiting in the
More information about the vlc-devel