38 #define UV_LOOP_WATCHER_DEFINE(name, NAME) \
39 int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
40 uv__handle_init(loop, (uv_handle_t*) handle, UV_##NAME); \
46 int uv_##name##_start(uv_##name##_t* handle, uv_##name##_cb cb) { \
47 uv_loop_t* loop = handle->loop; \
48 uv_##name##_t* old_head; \
50 assert(handle->type == UV_##NAME); \
52 if (uv__is_active(handle)) \
58 old_head = loop->name##_handles; \
60 handle->name##_next = old_head; \
61 handle->name##_prev = NULL; \
64 old_head->name##_prev = handle; \
67 loop->name##_handles = handle; \
69 handle->name##_cb = cb; \
70 uv__handle_start(handle); \
76 int uv_##name##_stop(uv_##name##_t* handle) { \
77 uv_loop_t* loop = handle->loop; \
79 assert(handle->type == UV_##NAME); \
81 if (!uv__is_active(handle)) \
85 if (loop->name##_handles == handle) { \
86 loop->name##_handles = handle->name##_next; \
90 if (loop->next_##name##_handle == handle) { \
91 loop->next_##name##_handle = handle->name##_next; \
94 if (handle->name##_prev) { \
95 handle->name##_prev->name##_next = handle->name##_next; \
97 if (handle->name##_next) { \
98 handle->name##_next->name##_prev = handle->name##_prev; \
101 uv__handle_stop(handle); \
107 void uv_##name##_invoke(uv_loop_t* loop) { \
108 uv_##name##_t* handle; \
110 (loop)->next_##name##_handle = (loop)->name##_handles; \
112 while ((loop)->next_##name##_handle != NULL) { \
113 handle = (loop)->next_##name##_handle; \
114 (loop)->next_##name##_handle = handle->name##_next; \
116 handle->name##_cb(handle); \
static mcore_handle handle
#define uv__handle_close(handle)
assert(limit<=UINT32_MAX/2)
void uv_loop_watcher_endgame(uv_loop_t *loop, uv_handle_t *handle)
#define UV_LOOP_WATCHER_DEFINE(name, NAME)