[vlc-devel] [PATCH] p2p-streaming module for VLC

Rémi Denis-Courmont remi at remlab.net
Thu Nov 4 22:18:03 CET 2010

Le jeudi 4 novembre 2010 23:02:45 David Fuhrmann, vous avez écrit :
> Am 04.11.2010 um 21:04 schrieb Rémi Denis-Courmont:
> > The use of singletons all over the place is suspicious. How is
> > re-entrancy handled?
> Sorry, what do you mean exactly?

How does this work if more than one thread tries to instantiate the access or 
access_output at the same time?

> > I spot thirty two thread creations
> That is wrong. We only create 4 threads at startup, not more.

Sure. You have cut&pasted the code 8 times, that makes 8*4=32 
vlc_thread_create() thread creation code paths.

> > yet not a single mutex. This is odd.
> The class DataStore saves all data, which should be accessible in all
> threads. As only one thread (controllerThread) writes on these values, we
> saw no need to use mutexes.

VLC uses the POSIX memory synchronization model, as defined at 
section A.4.11.

> > And then, we do not allow fixed msleep(), at least not within loops.
> We need to do some actions periodically, so we used msleep(). What else
> could be used with the same effect?

Normally you would use condition variables. Besides, msleep() cannot provide 
atomic access and is not a portable mechanism of memory synchronization.

Rémi Denis-Courmont

More information about the vlc-devel mailing list