From 0e67b34c27755b5258c8a1600ca80b08979ff592 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 23 Jun 2009 11:27:18 +0200 Subject: [PATCH] Fix thread pool unref issue. Tests were silently failing since f56309d... Since the eio_watcher is now not counted in the list of active watchers, we need to explicitly tell the ev_loop not to exit when entering the thread pool. --- src/file.cc | 4 +++- src/net.cc | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/file.cc b/src/file.cc index a8f7d4c1bfa..fc660d5ee6d 100644 --- a/src/file.cc +++ b/src/file.cc @@ -34,7 +34,8 @@ using namespace node; Local l = Local::Cast(last_arg); \ callback = new Persistent(); \ *callback = Persistent::New(l); \ - } + } \ + ev_ref(EV_DEFAULT_UC); #define CALL_CALLBACK_PTR(req, argc, argv) \ do { \ @@ -47,6 +48,7 @@ do { \ node::FatalException(try_catch); \ delete callback; \ } \ + ev_unref(EV_DEFAULT_UC); \ } while(0) #define DEFINE_SIMPLE_CB(name) \ diff --git a/src/net.cc b/src/net.cc index 5c3bbb66356..04a7fa0176f 100644 --- a/src/net.cc +++ b/src/net.cc @@ -211,6 +211,8 @@ Connection::Connect (const Arguments& args) } connection->opening = true; + + ev_ref(EV_DEFAULT_UC); #ifdef __APPLE__ /* HACK: Bypass the thread pool and do it sync on Macintosh. @@ -273,6 +275,8 @@ AddressDefaultToIPv4 (struct addrinfo *address_list) int Connection::AfterResolve (eio_req *req) { + ev_unref(EV_DEFAULT_UC); + Connection *connection = static_cast (req->data); struct addrinfo *address = NULL, *address_list = static_cast(req->ptr2);