… | |
… | |
950 | =item $w = $loop->check_ns ($callback) |
950 | =item $w = $loop->check_ns ($callback) |
951 | |
951 | |
952 | Call the callback just after the process wakes up again (after it has |
952 | Call the callback just after the process wakes up again (after it has |
953 | gathered events), but before any other callbacks have been invoked. |
953 | gathered events), but before any other callbacks have been invoked. |
954 | |
954 | |
955 | This is used to integrate other event-based software into the EV |
955 | This can be used to integrate other event-based software into the EV |
956 | mainloop: You register a prepare callback and in there, you create io and |
956 | mainloop: You register a prepare callback and in there, you create io and |
957 | timer watchers as required by the other software. Here is a real-world |
957 | timer watchers as required by the other software. Here is a real-world |
958 | example of integrating Net::SNMP (with some details left out): |
958 | example of integrating Net::SNMP (with some details left out): |
959 | |
959 | |
960 | our @snmp_watcher; |
960 | our @snmp_watcher; |
… | |
… | |
994 | The callbacks of the created watchers will not be called as the watchers |
994 | The callbacks of the created watchers will not be called as the watchers |
995 | are destroyed before this can happen (remember EV::check gets called |
995 | are destroyed before this can happen (remember EV::check gets called |
996 | first). |
996 | first). |
997 | |
997 | |
998 | The C<check_ns> variant doesn't start (activate) the newly created watcher. |
998 | The C<check_ns> variant doesn't start (activate) the newly created watcher. |
|
|
999 | |
|
|
1000 | =item EV::CHECK constant issues |
|
|
1001 | |
|
|
1002 | Like all other watcher types, there is a bitmask constant for use in |
|
|
1003 | C<$revents> and other places. The C<EV::CHECK> is special as it has |
|
|
1004 | the same name as the C<CHECK> sub called by Perl. This doesn't cause |
|
|
1005 | big issues on newer perls (beginning with 5.8.9), but it means thatthe |
|
|
1006 | constant must be I<inlined>, i.e. runtime calls will not work. That means |
|
|
1007 | that as long as you always C<use EV> and then C<EV::CHECK> you are on the |
|
|
1008 | safe side. |
999 | |
1009 | |
1000 | =back |
1010 | =back |
1001 | |
1011 | |
1002 | |
1012 | |
1003 | =head3 FORK WATCHERS - the audacity to resume the event loop after a fork |
1013 | =head3 FORK WATCHERS - the audacity to resume the event loop after a fork |