[poe-commits] poe/POE Kernel.pm,1.264,1.265
Brought to you by:
rcaputo
From: <rc...@us...> - 2003-11-20 19:22:16
|
Update of /cvsroot/poe/poe/POE In directory sc8-pr-cvs1:/tmp/cvs-serv9248/POE Modified Files: Kernel.pm Log Message: Reimplement _stop, mostly by moving the side effects out of _dispatch_event and into _data_ses_stop. This further shrinks _dispatch_event (some of POE's hottest code) and factors out more of the recursion and side effects that made it so difficult to work with. Index: Kernel.pm =================================================================== RCS file: /cvsroot/poe/poe/POE/Kernel.pm,v retrieving revision 1.264 retrieving revision 1.265 diff -C2 -d -r1.264 -r1.265 *** Kernel.pm 20 Nov 2003 17:13:41 -0000 1.264 --- Kernel.pm 20 Nov 2003 19:21:56 -0000 1.265 *************** *** 654,657 **** --- 654,659 ---- my $local_event = $event; + # TODO - Consider using times() or the POSIX equivalent to actually + # benchmark session vs. kernel time. if (TRACE_PROFILE) { $profile{$event}++; *************** *** 662,666 **** unless ($type & (ET_USER | ET_CALL)) { - # A "select" event has just come out of the queue. Reset its # actual state to its requested state before handling the event. --- 664,667 ---- *************** *** 682,723 **** } - # A session's about to stop. Notify its parents and children of - # the impending change in their relationships. Incidental _stop - # events are handled before the dispatch. - - elsif ($type & ET_STOP) { - - # Tell child sessions that they have a new parent (the departing - # session's parent). Tell the departing session's parent that - # it has new child sessions. - - my $parent = $self->_data_ses_get_parent($session); - - foreach my $child ($self->_data_ses_get_children($session)) { - $self->_dispatch_event - ( $parent, $self, - EN_CHILD, ET_CHILD, [ CHILD_GAIN, $child ], - $file, $line, time(), -__LINE__ - ); - $self->_dispatch_event - ( $child, $self, - EN_PARENT, ET_PARENT, - [ $self->_data_ses_get_parent($child), $parent, ], - $file, $line, time(), -__LINE__ - ); - } - - # Tell the departing session's parent that the departing session - # is departing. - - if (defined $parent) { - $self->_dispatch_event( - $parent, $self, - EN_CHILD, ET_CHILD, [ CHILD_LOSE, $session ], - $file, $line, time(), -__LINE__ - ); - } - } - # Preprocess signals. This is where _signal is translated into # its registered handler's event name, if there is one. --- 683,686 ---- *************** *** 902,915 **** } - # This session has stopped. Clean up after it. There's no - # garbage collection necessary since the session's stopped. - - if ($type & ET_STOP) { - $self->_data_ses_free($session); - } - # Step 3: Check for death by terminal signal. ! elsif ($type & (ET_SIGNAL | ET_SIGNAL_EXPLICIT | ET_SIGNAL_COMPATIBLE)) { $self->_data_sig_touched_session($session, $event, $return, $etc->[0]); --- 865,871 ---- } # Step 3: Check for death by terminal signal. ! if ($type & (ET_SIGNAL | ET_SIGNAL_EXPLICIT | ET_SIGNAL_COMPATIBLE)) { $self->_data_sig_touched_session($session, $event, $return, $etc->[0]); *************** *** 919,930 **** } ! # It's an alarm being dispatched. ! ! elsif ($type & ET_ALARM) { ! $self->_data_ses_collect_garbage($session); ! } ! # It's a select being dispatched. ! elsif ($type & ET_SELECT) { $self->_data_ses_collect_garbage($session); } --- 875,882 ---- } ! # These types of events require garbage collection afterwards, but ! # they don't need any other processing. ! elsif ($type & (ET_ALARM | ET_SELECT)) { $self->_data_ses_collect_garbage($session); } |