summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/core.c
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2013-05-30 01:09:54 +0200
committerBert Belder <bertbelder@gmail.com>2013-05-30 01:09:54 +0200
commit6b654c0b13f5399137ca71b177081ee6d0beb22e (patch)
tree81362751c0eca87a4f29c7f01f93408798a857f9 /deps/uv/src/unix/core.c
parentc188a7510317bfdaa19e87c6870c5ee7d965a6b9 (diff)
downloadandroid-node-v8-6b654c0b13f5399137ca71b177081ee6d0beb22e.tar.gz
android-node-v8-6b654c0b13f5399137ca71b177081ee6d0beb22e.tar.bz2
android-node-v8-6b654c0b13f5399137ca71b177081ee6d0beb22e.zip
uv: upgrade to v0.11.4
Diffstat (limited to 'deps/uv/src/unix/core.c')
-rw-r--r--deps/uv/src/unix/core.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index 98b48989a7..3eb45da477 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -162,7 +162,12 @@ void uv__make_close_pending(uv_handle_t* handle) {
static void uv__finish_close(uv_handle_t* handle) {
- assert(!uv__is_active(handle));
+ /* Note: while the handle is in the UV_CLOSING state now, it's still possible
+ * for it to be active in the sense that uv__is_active() returns true.
+ * A good example is when the user calls uv_shutdown(), immediately followed
+ * by uv_close(). The handle is considered active at this point because the
+ * completion of the shutdown req is still pending.
+ */
assert(handle->flags & UV_CLOSING);
assert(!(handle->flags & UV_CLOSED));
handle->flags |= UV_CLOSED;
@@ -220,7 +225,7 @@ static void uv__run_closing_handles(uv_loop_t* loop) {
int uv_is_closing(const uv_handle_t* handle) {
- return handle->flags & (UV_CLOSING | UV_CLOSED);
+ return uv__is_closing(handle);
}
@@ -312,8 +317,21 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
uv__io_poll(loop, timeout);
uv__run_check(loop);
uv__run_closing_handles(loop);
- r = uv__loop_alive(loop);
+ if (mode == UV_RUN_ONCE) {
+ /* UV_RUN_ONCE implies forward progess: at least one callback must have
+ * been invoked when it returns. uv__io_poll() can return without doing
+ * I/O (meaning: no callbacks) when its timeout expires - which means we
+ * have pending timers that satisfy the forward progress constraint.
+ *
+ * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from
+ * the check.
+ */
+ uv__update_time(loop);
+ uv__run_timers(loop);
+ }
+
+ r = uv__loop_alive(loop);
UV_TICK_STOP(loop, mode);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
@@ -335,11 +353,6 @@ void uv_update_time(uv_loop_t* loop) {
}
-uint64_t uv_now(uv_loop_t* loop) {
- return loop->time;
-}
-
-
int uv_is_active(const uv_handle_t* handle) {
return uv__is_active(handle);
}