[vlc-devel] Potential race condition in libvlc_media_player_play

Rémi Denis-Courmont remi at remlab.net
Thu May 7 17:41:12 CEST 2009


Le jeudi 7 mai 2009 18:02:43 Hugo Beauzee-Luyssen, vous avez écrit :
> After searching for a solution, I don't really see how this could be
> achieved without any modification to the way vlc starts the thread...

I guess so.

> One of the solution could be to add one parameter to
> input_CreateThread, which would be a function pointer. This could
> allow the thread creator to specify something different that the Run()
> function, which could create the variables and set the appropriate
> callbacks before calling Run().

IMHO, it is more natural to split the function as two separate creation and 
startup calls.

> Another solution I tried was to lock a mutex, making the thread wait
> until we want it to run. However, every mutex I came across was locked
> at least once before the thread was actually spawned...

That is do-able with a semaphore, but I fail to see any advantage over the 
above solution.

Rémi Denis-Courmont

More information about the vlc-devel mailing list