>use POSIX ":sys_wait_h";
        >Event->signal(signal => 'CHLD', cb => sub {
        >                 my ($e) = @_;
        >                 # warn "CHLD ".$e->hits;
        >                 for (my $h=0; $h < $e->hits; $h++) {
        >                     my $died = waitpid(-1,&WNOHANG);
        >                      # process it
        >                 }
        >             });

        From the pod:

        hits=>$int
          A watcher increments 'hits' every time it registers an event.
Signals in
          quick succession can be clumped into a single event.

        What happens if two sigs come in at the same time?  Will all signals
be
        handled by the cb accordingly?

        Also, does signal handling using Event.pm suffer from the same
problems
        in perl where a signal handler that does something that malloc()'s?
ie print().

> > $w=Event->io(fd=>\$server, poll=>'r' , cb=\&handle_client)
> > loop;
> > 
> > $sig_watch=Event->signal(signal=>'chld', async=>1, cb=\&chld_mangler)
> 
        >Why async=>1?

        I dunno .. sounded good ? :)

        >Only loop() once.  ;-)

        Ok. I have a better understanding now.  loop until unloop() (which
needs to be 
        in a cb)  So I can create many event watchers, and once I loop(),
they all kick off.    

> > Am I heading in the right direction?
> 
        >Yes.  :-)

        Cool.  :)

        Thanks,
        Matt Pavlovich 
        Allegiance Telecom, Inc.

Reply via email to