Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix, windows: rename flags UV__ACTIVE, UV__REF
Browse files Browse the repository at this point in the history
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 9d26f49
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/unix/core.c
Expand Up @@ -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;
}

Expand Down
34 changes: 17 additions & 17 deletions src/uv-common.h
Expand Up @@ -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_;
Expand Down Expand Up @@ -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))

Expand Down
5 changes: 3 additions & 2 deletions src/win/handle.c
Expand Up @@ -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++;
}
Expand Down
5 changes: 2 additions & 3 deletions src/win/internal.h
Expand Up @@ -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. */
Expand Down

0 comments on commit 9d26f49

Please sign in to comment.