… | |
… | |
2502 | =over 4 |
2502 | =over 4 |
2503 | |
2503 | |
2504 | =item ev_once (loop, int fd, int events, ev_tstamp timeout, callback) |
2504 | =item ev_once (loop, int fd, int events, ev_tstamp timeout, callback) |
2505 | |
2505 | |
2506 | This function combines a simple timer and an I/O watcher, calls your |
2506 | This function combines a simple timer and an I/O watcher, calls your |
2507 | callback on whichever event happens first and automatically stop both |
2507 | callback on whichever event happens first and automatically stops both |
2508 | watchers. This is useful if you want to wait for a single event on an fd |
2508 | watchers. This is useful if you want to wait for a single event on an fd |
2509 | or timeout without having to allocate/configure/start/stop/free one or |
2509 | or timeout without having to allocate/configure/start/stop/free one or |
2510 | more watchers yourself. |
2510 | more watchers yourself. |
2511 | |
2511 | |
2512 | If C<fd> is less than 0, then no I/O watcher will be started and events |
2512 | If C<fd> is less than 0, then no I/O watcher will be started and the |
2513 | is being ignored. Otherwise, an C<ev_io> watcher for the given C<fd> and |
2513 | C<events> argument is being ignored. Otherwise, an C<ev_io> watcher for |
2514 | C<events> set will be created and started. |
2514 | the given C<fd> and C<events> set will be created and started. |
2515 | |
2515 | |
2516 | If C<timeout> is less than 0, then no timeout watcher will be |
2516 | If C<timeout> is less than 0, then no timeout watcher will be |
2517 | started. Otherwise an C<ev_timer> watcher with after = C<timeout> (and |
2517 | started. Otherwise an C<ev_timer> watcher with after = C<timeout> (and |
2518 | repeat = 0) will be started. While C<0> is a valid timeout, it is of |
2518 | repeat = 0) will be started. While C<0> is a valid timeout, it is of |
2519 | dubious value. |
2519 | dubious value. |