diff options
Diffstat (limited to 'deps/uv/src/uv-common.h')
-rw-r--r-- | deps/uv/src/uv-common.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h index 4608ee549..e9caed9af 100644 --- a/deps/uv/src/uv-common.h +++ b/deps/uv/src/uv-common.h @@ -53,12 +53,14 @@ enum { UV__HANDLE_INTERNAL = 0x8000, UV__HANDLE_ACTIVE = 0x4000, - UV__HANDLE_REF = 0x2000 + UV__HANDLE_REF = 0x2000, + UV__HANDLE_CLOSING = 0 /* no-op on unix */ }; #else # define UV__HANDLE_INTERNAL 0x80 # define UV__HANDLE_ACTIVE 0x40 # define UV__HANDLE_REF 0x20 +# define UV__HANDLE_CLOSING 0x01 #endif extern const uv_err_t uv_ok_; @@ -129,28 +131,32 @@ UNUSED static int uv__is_active(const uv_handle_t* h) { UNUSED static void uv__handle_start(uv_handle_t* h) { if (h->flags & UV__HANDLE_ACTIVE) return; - if (h->flags & UV__HANDLE_REF) uv__active_handle_add(h); h->flags |= UV__HANDLE_ACTIVE; + if (h->flags & UV__HANDLE_CLOSING) return; + if (h->flags & UV__HANDLE_REF) uv__active_handle_add(h); } #define uv__handle_start(h) uv__handle_start((uv_handle_t*)(h)) UNUSED static void uv__handle_stop(uv_handle_t* h) { if (!(h->flags & UV__HANDLE_ACTIVE)) return; - if (h->flags & UV__HANDLE_REF) uv__active_handle_rm(h); h->flags &= ~UV__HANDLE_ACTIVE; + if (h->flags & UV__HANDLE_CLOSING) return; + if (h->flags & UV__HANDLE_REF) uv__active_handle_rm(h); } #define uv__handle_stop(h) uv__handle_stop((uv_handle_t*)(h)) UNUSED static void uv__handle_ref(uv_handle_t* h) { if (h->flags & UV__HANDLE_REF) return; - if (h->flags & UV__HANDLE_ACTIVE) uv__active_handle_add(h); + if (h->flags & (UV__HANDLE_ACTIVE | UV__HANDLE_CLOSING)) + uv__active_handle_add(h); h->flags |= UV__HANDLE_REF; } #define uv__handle_ref(h) uv__handle_ref((uv_handle_t*)(h)) UNUSED static void uv__handle_unref(uv_handle_t* h) { if (!(h->flags & UV__HANDLE_REF)) return; - if (h->flags & UV__HANDLE_ACTIVE) uv__active_handle_rm(h); + if (h->flags & (UV__HANDLE_ACTIVE | UV__HANDLE_CLOSING)) + uv__active_handle_rm(h); h->flags &= ~UV__HANDLE_REF; } #define uv__handle_unref(h) uv__handle_unref((uv_handle_t*)(h)) |