--- Async-Interrupt/Interrupt.pm 2009/07/30 03:59:47 1.21 +++ Async-Interrupt/Interrupt.pm 2015/02/11 19:31:21 1.34 @@ -116,7 +116,7 @@ pipe draining is not done automatically. my $interrupt = new Async::Interrupt - cb => sub { undef $SIGNAL_RECEIVED{$signum} } + cb => sub { undef $SIGNAL_RECEIVED{$signum} }, signal => $signum, pipe => [$SIGPIPE->filenos], pipe_autodrain => 0, @@ -235,10 +235,10 @@ BEGIN { # the next line forces initialisation of internal # signal handling variables, otherwise, PL_sig_pending - # etc. will be null pointers. + # etc. might be null pointers. $SIG{KILL} = sub { }; - our $VERSION = '1.0'; + our $VERSION = 1.21; require XSLoader; XSLoader::load ("Async::Interrupt", $VERSION); @@ -421,6 +421,23 @@ C<$value> must be in the valid range for a C, except C<0> (1..127 is portable). +=item $async->handle + +Calls the callback if the object is pending. + +This method does not need to be called normally, as it will be invoked +automatically. However, it can be used to force handling of outstanding +interrupts while the object is blocked. + +One reason why one might want to do that is when you want to switch +from asynchronous interruptions to synchronous one, using e.g. an event +loop. To do that, one would first C<< $async->block >> the interrupt +object, then register a read watcher on the C that calls C<< +$async->handle >>. + +This disables asynchronous interruptions, but ensures that interrupts are +handled by the event loop. + =item $async->signal_hysteresis ($enable) Enables or disables signal hysteresis (default: disabled). If a POSIX @@ -434,7 +451,7 @@ considerably, at the cost of two extra syscalls. Note that setting the signal to C can have unintended side -effects when you fork and exec other programs, as often they do nto expect +effects when you fork and exec other programs, as often they do not expect signals to be ignored by default. =item $async->block @@ -497,7 +514,7 @@ Returns the reading side of the signalling pipe. If no signalling pipe is currently attached to the object, it will dynamically create one. -Note that the only valid oepration on this file descriptor is to wait +Note that the only valid operation on this file descriptor is to wait until it is readable. The fd might belong currently to a pipe, a tcp socket, or an eventfd, depending on the platform, and is guaranteed to be C