It is time for the next step in the signal reforms.  The last step was
completed four months ago (on 2002-06-06) with the CPAN release of POE
0.20.  Jumbled notes about all this are at:

  http://poe.perl.org/?POE_RFCs/Signal_Reforms

This round of changes moves us closer to two goals.


1. Stop using return values to flag a signal as "handled".

PROBLEM: It is too easy to return the wrong thing by mistake.
Programs frequently exit when they shouldn't, or more commonly can't
be killed except through the harshest means.

SOLUTION: Use POE::Kernel's sig_handled() to flag the signal as
handled.  sig_handled() was added on 2002-05-09 and documented as the
recommended alternative to using return values.

THE NEXT STEP: Generate a warning if a signal handler returns true but
hasn't called sig_handled().  This will remind developers that signals
are being handled by deprecated means, but it will not break existing
programs.

IN THE FUTURE: After developers have had an opportunity to respond to
the warning, it will be upgraded to an error.  The code to monitor
return values will then be removed.


2. Stop handling signals that nothing is watching.

PROBLEM: POE registers internal handlers for every available signal,
regardless whether a program is interested in them.  One nasty side
effect of this practice is that SIGTSTP (generated when a user presses
^Z) does not suspend a POE program.

SOLUTION: Only register internal handlers for signals that a program
is interested in.  POE::Kernel will watch sig() calls and register or
remove internal signal handlers as necessary.

SIDE EFFECT: The catch-all _signal event will become obsolete since
signals will only be delivered upon request.  This has been documented
in POE::Kernel's man page since 2002-05-11, with a recommendation to
explicitly register handlers with sig().

THE NEXT STEP: Generate a warning if a signal event is handled by
_signal rather than an explicit event.  This will remind developers
that signals are being handled by deprecated means, but it will not
break existing programs.  Undocument _signal.

IN THE FUTURE: After developers have had an opportunity to respond to
the warning, it will be upgraded to an error.  The code to dispatch
_signal will then be removed.


While I've given these changes a lot of thought, I don't dismiss the
possibility that they may be dumb.  It's not too late to suggest
something smarter.

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net

Reply via email to