summaryrefslogtreecommitdiff
path: root/deps/uv/src/uv-common.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-06-06 05:21:07 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-06-06 05:31:08 +0200
commit5f411405356cd184560507ce870a664e4ef5417f (patch)
tree0befd01d900559c9eac032de763691fba8aa6f2e /deps/uv/src/uv-common.c
parent28e851c169ad589a7f6a1357fd84fd75254a2ab7 (diff)
downloadandroid-node-v8-5f411405356cd184560507ce870a664e4ef5417f.tar.gz
android-node-v8-5f411405356cd184560507ce870a664e4ef5417f.tar.bz2
android-node-v8-5f411405356cd184560507ce870a664e4ef5417f.zip
deps: upgrade libuv to 649ad50
Diffstat (limited to 'deps/uv/src/uv-common.c')
-rw-r--r--deps/uv/src/uv-common.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c
index 48f850c738..9639634a1d 100644
--- a/deps/uv/src/uv-common.c
+++ b/deps/uv/src/uv-common.c
@@ -22,6 +22,7 @@
#include "uv.h"
#include "uv-common.h"
+#include <stdio.h>
#include <assert.h>
#include <stddef.h> /* NULL */
#include <stdlib.h> /* malloc */
@@ -329,6 +330,50 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
}
+#ifndef NDEBUG
+static void uv__print_handles(uv_loop_t* loop, int only_active) {
+ const char* type;
+ ngx_queue_t* q;
+ uv_handle_t* h;
+
+ if (loop == NULL)
+ loop = uv_default_loop();
+
+ ngx_queue_foreach(q, &loop->handle_queue) {
+ h = ngx_queue_data(q, uv_handle_t, handle_queue);
+
+ if (only_active && !uv__is_active(h))
+ continue;
+
+ switch (h->type) {
+#define X(uc, lc) case UV_##uc: type = #lc; break;
+ UV_HANDLE_TYPE_MAP(X)
+#undef X
+ default: type = "<unknown>";
+ }
+
+ fprintf(stderr,
+ "[%c%c%c] %-8s %p\n",
+ "R-"[!(h->flags & UV__HANDLE_REF)],
+ "A-"[!(h->flags & UV__HANDLE_ACTIVE)],
+ "I-"[!(h->flags & UV__HANDLE_INTERNAL)],
+ type,
+ (void*)h);
+ }
+}
+
+
+void uv_print_all_handles(uv_loop_t* loop) {
+ uv__print_handles(loop, 0);
+}
+
+
+void uv_print_active_handles(uv_loop_t* loop) {
+ uv__print_handles(loop, 1);
+}
+#endif
+
+
void uv_ref(uv_handle_t* handle) {
uv__handle_ref(handle);
}