[patch] asynchronous callouts

David Zeuthen david at fubar.dk
Tue Apr 20 13:07:16 PDT 2004


On Tue, 2004-04-20 at 21:12, Joe Shaw wrote:
> Hi,
> 
> I just committed the attached patch, which makes the callouts
> asynchronous, but still executed one at a time.  This means that the
> daemon will be responsive now in callouts, and trying to use libhal or
> one of the utility functions from a callout won't deadlock things. :)
> 

Hi, I haven't been able to try the patch cause I've only got glib 2.2
installed; that should probably be fixed in the patch :-). 

Reviewing the patch, I've got a few issues though:

 1. We should ensure that the HalDevice is in the device list before
    calling out (so we can modify the device etc.), and on the 
    other ensure hand that we don't send out D-BUS signals before all
    callouts are finished (since applications may want to use the
    information that callouts can merge).

 2. The properties exported to the environment should be reconstructed
    just before each callout, as the subsequent callout may have
    modified the properties (quite likely). It seems that all callouts
    have the same environment?

 3. Calling waitpid during idletime may not be a good idea; I'd guess
    it would hog the CPU? Why don't we just listen for SIGCHILD?

 4. There's some static variables being used; that may not work 
    very well since as we may initiate a new set of callouts (e.g. 
    there may be a hotplug event) in the middle of processing another
    set of callouts?

Incidently I was working on the same feature, but it looks like you beat
me to! I've modeled it around some of the code that it attached (based
on some old code from hal 0.1) - it may be helpful; I haven't tested it
though.

> A good TODO item would be to have callouts time out after a while, say
> 20 seconds.  Another might be to spawn multiple callouts at once, with
> an upper bound of 2, 3, 5 or something.
> 

Yay, definately.

Cheers
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: async_spawn_helper.c
Type: text/x-c
Size: 7664 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040420/0418aae5/async_spawn_helper.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: async_spawn_helper.h
Type: text/x-c-header
Size: 3528 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040420/0418aae5/async_spawn_helper-0001.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list