… | |
… | |
233 | use common::sense; |
233 | use common::sense; |
234 | |
234 | |
235 | BEGIN { |
235 | BEGIN { |
236 | # the next line forces initialisation of internal |
236 | # the next line forces initialisation of internal |
237 | # signal handling variables, otherwise, PL_sig_pending |
237 | # signal handling variables, otherwise, PL_sig_pending |
238 | # etc. will be null pointers. |
238 | # etc. might be null pointers. |
239 | $SIG{KILL} = sub { }; |
239 | $SIG{KILL} = sub { }; |
240 | |
240 | |
241 | our $VERSION = '1.01'; |
241 | our $VERSION = '1.05'; |
242 | |
242 | |
243 | require XSLoader; |
243 | require XSLoader; |
244 | XSLoader::load ("Async::Interrupt", $VERSION); |
244 | XSLoader::load ("Async::Interrupt", $VERSION); |
245 | } |
245 | } |
246 | |
246 | |
… | |
… | |
432 | When you expect a lot of signals (e.g. when using SIGIO), then enabling |
432 | When you expect a lot of signals (e.g. when using SIGIO), then enabling |
433 | signal hysteresis can reduce the number of handler invocations |
433 | signal hysteresis can reduce the number of handler invocations |
434 | considerably, at the cost of two extra syscalls. |
434 | considerably, at the cost of two extra syscalls. |
435 | |
435 | |
436 | Note that setting the signal to C<SIG_IGN> can have unintended side |
436 | Note that setting the signal to C<SIG_IGN> can have unintended side |
437 | effects when you fork and exec other programs, as often they do nto expect |
437 | effects when you fork and exec other programs, as often they do not expect |
438 | signals to be ignored by default. |
438 | signals to be ignored by default. |
439 | |
439 | |
440 | =item $async->block |
440 | =item $async->block |
441 | |
441 | |
442 | =item $async->unblock |
442 | =item $async->unblock |
… | |
… | |
495 | =item $fileno = $async->pipe_fileno |
495 | =item $fileno = $async->pipe_fileno |
496 | |
496 | |
497 | Returns the reading side of the signalling pipe. If no signalling pipe is |
497 | Returns the reading side of the signalling pipe. If no signalling pipe is |
498 | currently attached to the object, it will dynamically create one. |
498 | currently attached to the object, it will dynamically create one. |
499 | |
499 | |
500 | Note that the only valid oepration on this file descriptor is to wait |
500 | Note that the only valid operation on this file descriptor is to wait |
501 | until it is readable. The fd might belong currently to a pipe, a tcp |
501 | until it is readable. The fd might belong currently to a pipe, a tcp |
502 | socket, or an eventfd, depending on the platform, and is guaranteed to be |
502 | socket, or an eventfd, depending on the platform, and is guaranteed to be |
503 | C<select>able. |
503 | C<select>able. |
504 | |
504 | |
505 | =item $async->pipe_autodrain ($enable) |
505 | =item $async->pipe_autodrain ($enable) |
… | |
… | |
536 | |
536 | |
537 | =back |
537 | =back |
538 | |
538 | |
539 | =head1 THE Async::Interrupt::EventPipe CLASS |
539 | =head1 THE Async::Interrupt::EventPipe CLASS |
540 | |
540 | |
541 | Pipes are the predominent utility to make asynchronous signals |
541 | Pipes are the predominant utility to make asynchronous signals |
542 | synchronous. However, pipes are hard to come by: they don't exist on the |
542 | synchronous. However, pipes are hard to come by: they don't exist on the |
543 | broken windows platform, and on GNU/Linux systems, you might want to use |
543 | broken windows platform, and on GNU/Linux systems, you might want to use |
544 | an C<eventfd> instead. |
544 | an C<eventfd> instead. |
545 | |
545 | |
546 | This class creates selectable event pipes in a portable fashion: on |
546 | This class creates selectable event pipes in a portable fashion: on |
… | |
… | |
576 | |
576 | |
577 | =item $epipe->drain |
577 | =item $epipe->drain |
578 | |
578 | |
579 | Drain (empty) the pipe. |
579 | Drain (empty) the pipe. |
580 | |
580 | |
|
|
581 | =item ($c_func, $c_arg) = $epipe->signal_func |
|
|
582 | |
581 | =item ($c_func, $c_arg) = $epipe->drain_func |
583 | =item ($c_func, $c_arg) = $epipe->drain_func |
582 | |
584 | |
583 | Returns a function pointer and C<void *> argument that can be called to |
585 | These two methods returns a function pointer and C<void *> argument |
584 | have the effect of C<< $epipe->drain >> on the XS level. |
586 | that can be called to have the effect of C<< $epipe->signal >> or C<< |
|
|
587 | $epipe->drain >>, respectively, on the XS level. |
585 | |
588 | |
586 | It has the following prototype and needs to be passed the specified |
589 | They both have the following prototype and need to be passed their |
587 | C<$c_arg>, which is a C<void *> cast to C<IV>: |
590 | C<$c_arg>, which is a C<void *> cast to an C<IV>: |
588 | |
591 | |
589 | void (*c_func) (void *c_arg) |
592 | void (*c_func) (void *c_arg) |
590 | |
593 | |
591 | An example call would look like: |
594 | An example call would look like: |
592 | |
595 | |