… | |
… | |
174 | =item ev_tstamp ev_time () |
174 | =item ev_tstamp ev_time () |
175 | |
175 | |
176 | Returns the current time as libev would use it. Please note that the |
176 | Returns the current time as libev would use it. Please note that the |
177 | C<ev_now> function is usually faster and also often returns the timestamp |
177 | C<ev_now> function is usually faster and also often returns the timestamp |
178 | you actually want to know. Also interesting is the combination of |
178 | you actually want to know. Also interesting is the combination of |
179 | C<ev_update_now> and C<ev_now>. |
179 | C<ev_now_update> and C<ev_now>. |
180 | |
180 | |
181 | =item ev_sleep (ev_tstamp interval) |
181 | =item ev_sleep (ev_tstamp interval) |
182 | |
182 | |
183 | Sleep for the given interval: The current thread will be blocked |
183 | Sleep for the given interval: The current thread will be blocked |
184 | until either it is interrupted or the given time interval has |
184 | until either it is interrupted or the given time interval has |
… | |
… | |
1020 | can be done relatively simply by putting mutex_lock/unlock calls around |
1020 | can be done relatively simply by putting mutex_lock/unlock calls around |
1021 | each call to a libev function. |
1021 | each call to a libev function. |
1022 | |
1022 | |
1023 | However, C<ev_run> can run an indefinite time, so it is not feasible |
1023 | However, C<ev_run> can run an indefinite time, so it is not feasible |
1024 | to wait for it to return. One way around this is to wake up the event |
1024 | to wait for it to return. One way around this is to wake up the event |
1025 | loop via C<ev_break> and C<av_async_send>, another way is to set these |
1025 | loop via C<ev_break> and C<ev_async_send>, another way is to set these |
1026 | I<release> and I<acquire> callbacks on the loop. |
1026 | I<release> and I<acquire> callbacks on the loop. |
1027 | |
1027 | |
1028 | When set, then C<release> will be called just before the thread is |
1028 | When set, then C<release> will be called just before the thread is |
1029 | suspended waiting for new events, and C<acquire> is called just |
1029 | suspended waiting for new events, and C<acquire> is called just |
1030 | afterwards. |
1030 | afterwards. |
… | |
… | |
1958 | |
1958 | |
1959 | If you ask a timer to call your callback after three seconds, then |
1959 | If you ask a timer to call your callback after three seconds, then |
1960 | you expect it to be invoked after three seconds - but of course, this |
1960 | you expect it to be invoked after three seconds - but of course, this |
1961 | cannot be guaranteed to infinite precision. Less obviously, it cannot be |
1961 | cannot be guaranteed to infinite precision. Less obviously, it cannot be |
1962 | guaranteed to any precision by libev - imagine somebody suspending the |
1962 | guaranteed to any precision by libev - imagine somebody suspending the |
1963 | process a STOP signal for a few hours for example. |
1963 | process with a STOP signal for a few hours for example. |
1964 | |
1964 | |
1965 | So, libev tries to invoke your callback as soon as possible I<after> the |
1965 | So, libev tries to invoke your callback as soon as possible I<after> the |
1966 | delay has occurred, but cannot guarantee this. |
1966 | delay has occurred, but cannot guarantee this. |
1967 | |
1967 | |
1968 | A less obvious failure mode is calling your callback too early: many event |
1968 | A less obvious failure mode is calling your callback too early: many event |
… | |
… | |
3473 | ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0); |
3473 | ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0); |
3474 | |
3474 | |
3475 | =item ev_feed_fd_event (loop, int fd, int revents) |
3475 | =item ev_feed_fd_event (loop, int fd, int revents) |
3476 | |
3476 | |
3477 | Feed an event on the given fd, as if a file descriptor backend detected |
3477 | Feed an event on the given fd, as if a file descriptor backend detected |
3478 | the given events it. |
3478 | the given events. |
3479 | |
3479 | |
3480 | =item ev_feed_signal_event (loop, int signum) |
3480 | =item ev_feed_signal_event (loop, int signum) |
3481 | |
3481 | |
3482 | Feed an event as if the given signal occurred. See also C<ev_feed_signal>, |
3482 | Feed an event as if the given signal occurred. See also C<ev_feed_signal>, |
3483 | which is async-safe. |
3483 | which is async-safe. |