PATCH: Shortcut activation if exec is already being started

Havoc Pennington hp@redhat.com
Thu Mar 11 13:44:28 PST 2004


On Thu, 2004-03-11 at 07:49, Mikael Hallendal wrote:
> Hi!
> 
> This is a patch that shortcuts the spawning of another instance of the
> same exec if it's already in the pending queue. This is useful if two
> services are provided by the same binary, if one of the services are
> already pending there is no point in starting another instance of the
> same executable.

I imagine you want to do this by comparing an argv vector:

 - if you compare only argv[0] then you can't have something like 
   "foo --service=bar" and "foo --service=baz"

 - if you compare the flattened command line, the optimization will be 
   defeated if someone changes the whitespace

Of course:
  /* FIXME we need to support a full command line, not just a single
   * argv[0]
   */
Maybe we should fix that ;-)

A problem with the patch is that the second activation will always time
out if the activated process exits with a failure code, while the first
activation will be canceled immediately. Maybe there's an easy and
uncomplicated way to fix that? It's probably best to just ignore if the
fix makes a mess.

Havoc







More information about the dbus mailing list