Replacing evil looping code

Kevin Krammer kevin.krammer at gmx.at
Mon Nov 6 11:04:26 PST 2006


On Monday 06 November 2006 16:47, Bastien Nocera wrote:
> Hey Havoc,
>
> On Mon, 2006-11-06 at 10:12 -0500, Havoc Pennington wrote:
> > Hi,
> >
> > > Is it possible to replace all that crap with decent D-Bus code?
> > >
> > > I don't think we can use a service, as we're depending on some
> > > command-line arguments (should we pass those to the service in some
> > > other way instead?).
> >
> > Remember you can autostart a service by just sending it a method call,
> > so if your command line args can be args to a method that might work.
>
> I figured that much. But see below.
>
> > The showstopper for using a service in your case looks like the dynamic
> > bus name creation (putting the pid in there), there's no way to put the
> > dynamic bus name in the .service file.
>
> To be fair, we don't really need that "PID" bit, but we'd need one
> instance of the service per instance of our plugin in Mozilla (well,
> pretty much).
>
> If we can that one-to-one relationship without using a dynamic service
> name, it wouldn't bother me one bit to use it. I didn't see any ways to
> have that using the service route.

You could do a method call to your own starter service which can be 
autostarted by the bus.
The starter service would have a common name and it would exec/fork the 
process you requested.

A bit like a factory: you ask the factory for an instance, it returns the new 
instance, but instead of a pointer you get e.g. the unique connection name. 
The bus takes care about starting the factory in case it is not yet running.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061106/4953a5ee/attachment.pgp


More information about the dbus mailing list