ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Async-Interrupt/Interrupt.pm
(Generate patch)

Comparing cvsroot/Async-Interrupt/Interrupt.pm (file contents):
Revision 1.38 by root, Sun Apr 21 09:42:27 2019 UTC vs.
Revision 1.39 by root, Thu Jul 18 09:13:00 2019 UTC

38 38
39You can use this module to bind a signal to a callback while at the same 39You can use this module to bind a signal to a callback while at the same
40time activating an event pipe that you can C<select> on, fixing the race 40time activating an event pipe that you can C<select> on, fixing the race
41completely. 41completely.
42 42
43This can be used to implement the signal hadling in event loops, 43This can be used to implement the signal handling in event loops,
44e.g. L<AnyEvent>, L<POE>, L<IO::Async::Loop> and so on. 44e.g. L<AnyEvent>, L<POE>, L<IO::Async::Loop> and so on.
45 45
46=item Background threads want speedy reporting 46=item Background threads want speedy reporting
47 47
48Assume you want very exact timing, and you can spare an extra cpu core 48Assume you want very exact timing, and you can spare an extra cpu core
158 _attach $self, $asy->signal_func; 158 _attach $self, $asy->signal_func;
159 159
160So to repeat: first the XS object is created, then it is queried for the 160So to repeat: first the XS object is created, then it is queried for the
161callback that should be called when the Interrupt object gets signalled. 161callback that should be called when the Interrupt object gets signalled.
162 162
163Then the interrupt object is queried for the callback fucntion that the 163Then the interrupt object is queried for the callback function that the
164thread should call to signal the Interrupt object, and this callback is 164thread should call to signal the Interrupt object, and this callback is
165then attached to the thread. 165then attached to the thread.
166 166
167You have to be careful that your new thread is not signalling before the 167You have to be careful that your new thread is not signalling before the
168signal function was configured, for example by starting the background 168signal function was configured, for example by starting the background
638=head1 IMPLEMENTATION DETAILS AND LIMITATIONS 638=head1 IMPLEMENTATION DETAILS AND LIMITATIONS
639 639
640This module works by "hijacking" SIGKILL, which is guaranteed to always 640This module works by "hijacking" SIGKILL, which is guaranteed to always
641exist, but also cannot be caught, so is always available. 641exist, but also cannot be caught, so is always available.
642 642
643Basically, this module fakes the occurance of a SIGKILL signal and 643Basically, this module fakes the occurence of a SIGKILL signal and
644then intercepts the interpreter handling it. This makes normal signal 644then intercepts the interpreter handling it. This makes normal signal
645handling slower (probably unmeasurably, though), but has the advantage 645handling slower (probably unmeasurably, though), but has the advantage
646of not requiring a special runops function, nor slowing down normal perl 646of not requiring a special runops function, nor slowing down normal perl
647execution a bit. 647execution a bit.
648 648

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines