[patch] asynchronous callouts

Joe Shaw joe at ximian.com
Tue Apr 20 13:50:37 PDT 2004


Ok, I've committed some of this:

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

I fixed the GPid thing to just be an int.  Sorry about breaking the
build, I forgot about that change.

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

This is fixed.

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

I remember now why I didn't do this originally: it's an incredible pain
in the ass. :)  The only safe way to do it is to set up a pipe and have
the SIGCHLD handler write to it and have the other end attached to the
main loop via g_io_watch_add(), since we could be interrupting anything
and breaking stuff.  Unfortunately, glib 2.4 has exactly what we want
for this. :)  I can take a look at it a little more tomorrow (I have to
go soon), but in the meantime I've changed the idle to a 250 ms timeout.
Yeah, it's a cop-out, but it doesn't peg the CPU.

Joe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hald-async-callout-2.patch
Type: text/x-patch
Size: 4454 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040420/f5440d59/hald-async-callout-2.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list