SPUG: Forked Children talking back to the parent?

John Labovitz johnl at meer.net
Thu Jan 18 11:39:20 CST 2001


On Thu, Jan 18, 2001 at 08:21:12AM -0800, Richard Wood wrote:
> My question on the interrupt driven approach is, what
> happens if I am processing a signal from one child in
> the parent and I receive a signal from another child? 
> Does it interrupt the code already processing the
> first signal?  I haven't done much signal processing.

>From the "perlipc" manpage:

    Do as little as you possibly can in your handler; notice how all
    we do is set a global variable and then raise an exception.
    That's because on most systems, libraries are not re-entrant;
    particularly, memory allocation and I/O routines are not.  That
    means that doing nearly anything in your handler could in theory
    trigger a memory fault and subsequent core dump.

In your signal handler, you could simply "push" some sort of
identifier onto a list; then, when you are back in your main loop,
process the list one element at a time.

john

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list