… | |
… | |
1625 | |
1625 | |
1626 | =back |
1626 | =back |
1627 | |
1627 | |
1628 | =head3 Examples |
1628 | =head3 Examples |
1629 | |
1629 | |
1630 | Example: Try to exit cleanly on SIGINT and SIGTERM. |
1630 | Example: Try to exit cleanly on SIGINT. |
1631 | |
1631 | |
1632 | static void |
1632 | static void |
1633 | sigint_cb (struct ev_loop *loop, struct ev_signal *w, int revents) |
1633 | sigint_cb (struct ev_loop *loop, struct ev_signal *w, int revents) |
1634 | { |
1634 | { |
1635 | ev_unloop (loop, EVUNLOOP_ALL); |
1635 | ev_unloop (loop, EVUNLOOP_ALL); |
1636 | } |
1636 | } |
1637 | |
1637 | |
1638 | struct ev_signal signal_watcher; |
1638 | struct ev_signal signal_watcher; |
1639 | ev_signal_init (&signal_watcher, sigint_cb, SIGINT); |
1639 | ev_signal_init (&signal_watcher, sigint_cb, SIGINT); |
1640 | ev_signal_start (loop, &sigint_cb); |
1640 | ev_signal_start (loop, &signal_watcher); |
1641 | |
1641 | |
1642 | |
1642 | |
1643 | =head2 C<ev_child> - watch out for process status changes |
1643 | =head2 C<ev_child> - watch out for process status changes |
1644 | |
1644 | |
1645 | Child watchers trigger when your process receives a SIGCHLD in response to |
1645 | Child watchers trigger when your process receives a SIGCHLD in response to |