[patch] asynchronous callouts

Joe Shaw joe at ximian.com
Tue Apr 20 13:23:33 PDT 2004


On Tue, 2004-04-20 at 22:07 +0200, David Zeuthen wrote:
> 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 :-). 

Oh, the GPid thing?  I forgot about that.  It can safely be replaced
with "int".  I think they did it for win32 compatibility.

>  1. We should ensure that the HalDevice is in the device list before
>     calling out (so we can modify the device etc.) ...

Do you mean that the state of the device might have changed between when
the callout was queued up and when it runs?  Because right now
hald.c:gdl_store_changed() is what calls hal_callout_device(), so it'll
only happen when added to or removed from the GDL.

>     ... 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).

Right now we're calling manager_send_signal_device_added() before
hald_callout_device() in hald.c:gdl_store_changed(), but those can be
swapped.

>  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?

Good point.  That's easy to fix.

>  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?

We can probably do 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?

They'll be queued up after the current set of callouts.  That's why I
decided to make it a global instead of per-callout.

> 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.

I'll take a look at it, thanks.

Joe


_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list