unix: move active checks out of core.c
Move active checks out of core.c and into their respective compilation units: check, idle, prepare, timer.
This commit is contained in:
parent
5a59e4924a
commit
5fbe0aab33
@ -68,3 +68,8 @@ int uv_check_stop(uv_check_t* check) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uv__check_active(const uv_check_t* handle) {
|
||||
return ev_is_active(&handle->check_watcher);
|
||||
}
|
||||
|
||||
@ -340,20 +340,16 @@ void uv__req_init(uv_loop_t* loop, uv_req_t* req) {
|
||||
|
||||
int uv_is_active(uv_handle_t* handle) {
|
||||
switch (handle->type) {
|
||||
case UV_TIMER:
|
||||
return ev_is_active(&((uv_timer_t*)handle)->timer_watcher);
|
||||
|
||||
case UV_PREPARE:
|
||||
return ev_is_active(&((uv_prepare_t*)handle)->prepare_watcher);
|
||||
|
||||
case UV_CHECK:
|
||||
return ev_is_active(&((uv_check_t*)handle)->check_watcher);
|
||||
|
||||
case UV_IDLE:
|
||||
return ev_is_active(&((uv_idle_t*)handle)->idle_watcher);
|
||||
|
||||
default:
|
||||
return 1;
|
||||
case UV_CHECK:
|
||||
return uv__check_active((uv_check_t*)handle);
|
||||
case UV_IDLE:
|
||||
return uv__idle_active((uv_idle_t*)handle);
|
||||
case UV_PREPARE:
|
||||
return uv__prepare_active((uv_prepare_t*)handle);
|
||||
case UV_TIMER:
|
||||
return uv__timer_active((uv_timer_t*)handle);
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -67,3 +67,8 @@ int uv_idle_stop(uv_idle_t* idle) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uv__idle_active(const uv_idle_t* handle) {
|
||||
return ev_is_active(&handle->idle_watcher);
|
||||
}
|
||||
|
||||
@ -139,6 +139,11 @@ void uv__udp_finish_close(uv_udp_t* handle);
|
||||
/* fs */
|
||||
void uv__fs_event_destroy(uv_fs_event_t* handle);
|
||||
|
||||
int uv__check_active(const uv_check_t* handle);
|
||||
int uv__idle_active(const uv_idle_t* handle);
|
||||
int uv__prepare_active(const uv_prepare_t* handle);
|
||||
int uv__timer_active(const uv_timer_t* handle);
|
||||
|
||||
#define UV__F_IPC (1 << 0)
|
||||
#define UV__F_NONBLOCK (1 << 1)
|
||||
int uv__make_socketpair(int fds[2], int flags);
|
||||
|
||||
@ -67,3 +67,8 @@ int uv_prepare_stop(uv_prepare_t* prepare) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uv__prepare_active(const uv_prepare_t* handle) {
|
||||
return ev_is_active(&handle->prepare_watcher);
|
||||
}
|
||||
|
||||
@ -23,11 +23,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
static int uv__timer_active(const uv_timer_t* timer) {
|
||||
return timer->flags & UV_TIMER_ACTIVE;
|
||||
}
|
||||
|
||||
|
||||
static int uv__timer_repeating(const uv_timer_t* timer) {
|
||||
return timer->flags & UV_TIMER_REPEAT;
|
||||
}
|
||||
@ -120,3 +115,8 @@ int64_t uv_timer_get_repeat(uv_timer_t* timer) {
|
||||
assert(timer->type == UV_TIMER);
|
||||
return (int64_t)(1000 * timer->timer_watcher.repeat);
|
||||
}
|
||||
|
||||
|
||||
int uv__timer_active(const uv_timer_t* timer) {
|
||||
return timer->flags & UV_TIMER_ACTIVE;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user