uv_is_active api and windows implementation

This commit is contained in:
Bert Belder 2011-05-16 21:40:07 +02:00
parent 84a0e899b5
commit 2aefc18d3a
2 changed files with 18 additions and 0 deletions

View File

@ -1347,6 +1347,19 @@ int uv_idle_stop(uv_handle_t* handle) {
}
int uv_is_active(uv_handle_t* handle) {
switch (handle->type) {
case UV_IDLE:
case UV_PREPARE:
case UV_CHECK:
return (handle->flags & UV_HANDLE_ACTIVE) ? 1 : 0;
default:
return 1;
}
}
int uv_async_init(uv_handle_t* handle, uv_async_cb async_cb,
uv_close_cb close_cb, void* data) {
uv_req_t* req;

5
uv.h
View File

@ -248,6 +248,11 @@ int uv_idle_init(uv_handle_t* handle, uv_close_cb close_cb, void* data);
int uv_idle_start(uv_handle_t* handle, uv_loop_cb cb);
int uv_idle_stop(uv_handle_t* handle);
/* Returns 1 if the prepare/check/idle handle has been started, 0 otherwise.
* For other handle types this always returns 1.
*/
int uv_is_active(uv_handle_t* handle);
/* libev wrapper. uv_async_send wakes up the event loop and calls the async
* handle's callback There is no guarantee that every uv_async_send call
* leads to exactly one invocation of the callback; The only guarantee is