diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-10-06 23:04:30 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-10-07 00:44:38 +0200 |
commit | ee77a6a953c65ff1fddf4017496387c42dd84d63 (patch) | |
tree | e87fedec086f8411ac52027c6a7570f60e30bd1d /deps/uv/src/fs-poll.c | |
parent | 836a06fc4f4920d5e9675763290c97aa4e7288fe (diff) | |
download | android-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.tar.gz android-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.tar.bz2 android-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.zip |
deps: upgrade libuv to b9ed1a6
Diffstat (limited to 'deps/uv/src/fs-poll.c')
-rw-r--r-- | deps/uv/src/fs-poll.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/deps/uv/src/fs-poll.c b/deps/uv/src/fs-poll.c index f71aa842ee..b5b344b920 100644 --- a/deps/uv/src/fs-poll.c +++ b/deps/uv/src/fs-poll.c @@ -103,11 +103,15 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) { ctx = handle->poll_ctx; assert(ctx != NULL); assert(ctx->parent_handle != NULL); - ctx->parent_handle = NULL; - uv_timer_stop(&ctx->timer_handle); - handle->poll_ctx = NULL; + + /* Close the timer if it's active. If it's inactive, there's a stat request + * in progress and poll_cb will take care of the cleanup. + */ + if (uv__is_active(&ctx->timer_handle)) + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + uv__handle_stop(handle); return 0; @@ -123,12 +127,7 @@ static void timer_cb(uv_timer_t* timer, int status) { struct poll_ctx* ctx; ctx = container_of(timer, struct poll_ctx, timer_handle); - - if (ctx->parent_handle == NULL) { /* handle has been stopped or closed */ - uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); - return; - } - + assert(ctx->parent_handle != NULL); assert(ctx->parent_handle->poll_ctx == ctx); ctx->start_time = uv_now(ctx->loop); @@ -171,6 +170,11 @@ static void poll_cb(uv_fs_t* req) { out: uv_fs_req_cleanup(req); + if (ctx->parent_handle == NULL) { /* handle has been stopped by callback */ + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + return; + } + /* Reschedule timer, subtract the delay from doing the stat(). */ interval = ctx->interval; interval -= (uv_now(ctx->loop) - ctx->start_time) % interval; |