unix: change uv_backend_timeout() prototype
* change return value to signed int * constify loop argument
This commit is contained in:
parent
09a7f85b70
commit
4a69c4bb5f
16
include/uv.h
16
include/uv.h
@ -262,16 +262,26 @@ UV_EXTERN void uv_update_time(uv_loop_t*);
|
||||
UV_EXTERN int64_t uv_now(uv_loop_t*);
|
||||
|
||||
/*
|
||||
* Get backend file descriptor and get polling timeout for it.
|
||||
* (only kqueue, epoll and event ports are supported).
|
||||
* Get backend file descriptor. Only kqueue, epoll and event ports are
|
||||
* supported.
|
||||
*
|
||||
* This can be used in conjuction with uv_run_once() to poll in one thread and
|
||||
* run the event loop's event callbacks in another.
|
||||
*
|
||||
* Useful for embedding libuv's event loop in another event loop.
|
||||
* See test/test-embed.c for an example.
|
||||
*
|
||||
* Note that embedding a kqueue fd in another kqueue pollset doesn't work on
|
||||
* all platforms. It's not an error to add the fd but it never generates
|
||||
* events.
|
||||
*/
|
||||
UV_EXTERN int uv_backend_fd(const uv_loop_t*);
|
||||
UV_EXTERN unsigned int uv_backend_timeout(uv_loop_t*);
|
||||
|
||||
/*
|
||||
* Get the poll timeout. The return value is in milliseconds, or -1 for no
|
||||
* timeout.
|
||||
*/
|
||||
UV_EXTERN int uv_backend_timeout(const uv_loop_t*);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -253,7 +253,7 @@ int uv_backend_fd(const uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
unsigned int uv_backend_timeout(uv_loop_t* loop) {
|
||||
int uv_backend_timeout(const uv_loop_t* loop) {
|
||||
if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop))
|
||||
return 0;
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb);
|
||||
|
||||
/* timer */
|
||||
void uv__run_timers(uv_loop_t* loop);
|
||||
unsigned int uv__next_timeout(uv_loop_t* loop);
|
||||
int uv__next_timeout(const uv_loop_t* loop);
|
||||
|
||||
/* signal */
|
||||
void uv__signal_close(uv_signal_t* handle);
|
||||
|
||||
@ -102,13 +102,14 @@ int64_t uv_timer_get_repeat(uv_timer_t* handle) {
|
||||
}
|
||||
|
||||
|
||||
unsigned int uv__next_timeout(uv_loop_t* loop) {
|
||||
uv_timer_t* handle;
|
||||
int uv__next_timeout(const uv_loop_t* loop) {
|
||||
const uv_timer_t* handle;
|
||||
|
||||
handle = RB_MIN(uv__timers, &loop->timer_handles);
|
||||
/* RB_MIN expects a non-const tree root. That's okay, it doesn't modify it. */
|
||||
handle = RB_MIN(uv__timers, (struct uv__timers*) &loop->timer_handles);
|
||||
|
||||
if (handle == NULL)
|
||||
return (unsigned int) -1; /* block indefinitely */
|
||||
return -1; /* block indefinitely */
|
||||
|
||||
if (handle->timeout <= loop->time)
|
||||
return 0;
|
||||
|
||||
@ -176,7 +176,7 @@ int uv_backend_fd(const uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
unsigned int uv_backend_timeout(uv_loop_t* loop) {
|
||||
int uv_backend_timeout(const uv_loop_t* loop) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ static int embed_timer_called;
|
||||
static void embed_thread_runner(void* arg) {
|
||||
int r;
|
||||
int fd;
|
||||
unsigned int timeout;
|
||||
int timeout;
|
||||
|
||||
while (!embed_closed) {
|
||||
fd = uv_backend_fd(uv_default_loop());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user