[vlc-devel] [PATCH] GSoC: lua services discovery, first try

Rémi Denis-Courmont remi at remlab.net
Thu Jul 23 19:35:34 CEST 2009


Le jeudi 23 juillet 2009 20:05:23 Fabio Ritrovato, vous avez écrit :
> > I just don't see the point. By the time "another" thread can access your
> > item, it ought to have all parameters set for good. Otherwise, you'll get
> > really weird side effects, if you did not add all parameters yet, but
> > someone else tries to use the item anyway.
>
> If the list is a bit long, it can happen that the interface access it
> before the SD is done setting it...
> With the lock, there should not be weird effects, if the interface
> tries to read, it waits till it's done...

I don't understand what prevents the "interface" thread from obtaining the 
lock between two invocations of services_discovery_AddParameterValue() by the 
SD thread? or even before the first invocation of 
services_discovery_AddParameterValue(), right after the item would be 
inserted?

> > It does not make sense to use module_get_name() on your own self. When a
> > module wants to know its own name for aliasing purpose, we add it in the
> > object typedef (e.g. access_t.psz_access, demux_t.psz_demux...) and set
> > it before calling module_need(). It's just that SD never needed it this
> > far. Using event handlers seems backward.
>
> I agree that it usually it does not make very sense, but in this case,
> the module it's a generic one, that's copied for every script you put
> in the folder (see lua/vlc.c code), and so, the module has no way to
> know it's name until after it's been set by module_need...

I got that.

> Another way could be to save the module name in p_sd before the module
> is started, if that's better...

Yes, that was my point.
And then you can simply return an error if vlc_clone() should fail.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list