Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

unix, windows: rename flags UV__ACTIVE, UV__REF

Rename UV__ACTIVE and UV__REF to UV__HANDLE_ACTIVE and UV__HANDLE_REF to make
it clear that they apply to handles, not requests or loops.
  • Loading branch information
bnoordhuis committed May 29, 2012
1 parent 58a272e commit 9d26f49725be64e588012d995c66fe312ad92f70
Showing with 23 additions and 23 deletions.
  1. +1 −1 src/unix/core.c
  2. +17 −17 src/uv-common.h
  3. +3 −2 src/win/handle.c
  4. +2 −3 src/win/internal.h
@@ -276,7 +276,7 @@ void uv__handle_init(uv_loop_t* loop, uv_handle_t* handle,

handle->loop = loop;
handle->type = type;
handle->flags = UV__REF; /* ref the loop when active */
handle->flags = UV__HANDLE_REF; /* ref the loop when active */
handle->next_closing = NULL;
}

@@ -49,12 +49,12 @@

#ifndef _WIN32
enum {
UV__ACTIVE = 0x4000,
UV__REF = 0x8000
UV__HANDLE_ACTIVE = 0x4000,
UV__HANDLE_REF = 0x8000
};
#else
# define UV__REF 0x00000020
# define UV__ACTIVE 0x00000040
# define UV__HANDLE_ACTIVE 0x40
# define UV__HANDLE_REF 0x20
#endif

extern const uv_err_t uv_ok_;
@@ -117,35 +117,35 @@ UNUSED static void uv__active_handle_rm(uv_handle_t* h) {
#define uv__req_unregister(loop, req) uv__req_unregister((loop), (uv_req_t*)(req))

UNUSED static int uv__is_active(const uv_handle_t* h) {
return !!(h->flags & UV__ACTIVE);
return !!(h->flags & UV__HANDLE_ACTIVE);
}
#define uv__is_active(h) uv__is_active((const uv_handle_t*)(h))

UNUSED static void uv__handle_start(uv_handle_t* h) {
if (h->flags & UV__ACTIVE) return;
if (h->flags & UV__REF) uv__active_handle_add(h);
h->flags |= UV__ACTIVE;
if (h->flags & UV__HANDLE_ACTIVE) return;
if (h->flags & UV__HANDLE_REF) uv__active_handle_add(h);
h->flags |= UV__HANDLE_ACTIVE;
}
#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__ACTIVE)) return;
if (h->flags & UV__REF) uv__active_handle_rm(h);
h->flags &= ~UV__ACTIVE;
if (!(h->flags & UV__HANDLE_ACTIVE)) return;
if (h->flags & UV__HANDLE_REF) uv__active_handle_rm(h);
h->flags &= ~UV__HANDLE_ACTIVE;
}
#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__REF) return;
if (h->flags & UV__ACTIVE) uv__active_handle_add(h);
h->flags |= UV__REF;
if (h->flags & UV__HANDLE_REF) return;
if (h->flags & UV__HANDLE_ACTIVE) 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__REF)) return;
if (h->flags & UV__ACTIVE) uv__active_handle_rm(h);
h->flags &= ~UV__REF;
if (!(h->flags & UV__HANDLE_REF)) return;
if (h->flags & UV__HANDLE_ACTIVE) uv__active_handle_rm(h);
h->flags &= ~UV__HANDLE_REF;
}
#define uv__handle_unref(h) uv__handle_unref((uv_handle_t*)(h))

@@ -57,13 +57,14 @@ uv_handle_type uv_guess_handle(uv_file file) {


int uv_is_active(const uv_handle_t* handle) {
return (handle->flags & UV__ACTIVE) && !(handle->flags & UV_HANDLE_CLOSING);
return (handle->flags & UV__HANDLE_ACTIVE) &&
!(handle->flags & UV_HANDLE_CLOSING);
}


void uv_handle_init(uv_loop_t* loop, uv_handle_t* handle) {
handle->loop = loop;
handle->flags = UV__REF;
handle->flags = UV__HANDLE_REF;

loop->counters.handle_init++;
}
@@ -40,9 +40,8 @@
#define UV_HANDLE_ENDGAME_QUEUED 0x00000004
#define UV_HANDLE_ACTIVE 0x00000010

/* Keep in sync with uv-common.h: */
#define UV__REF 0x00000020
#define UV__ACTIVE 0x00000040
/* uv-common.h: #define UV__HANDLE_ACTIVE 0x00000040 */
/* uv-common.h: #define UV__HANDLE_REF 0x00000020 */
/* reserved: #define UV_HANDLE_INTERNAL 0x00000080 */

/* Used by streams and UDP handles. */

0 comments on commit 9d26f49

Please sign in to comment.
You can’t perform that action at this time.