summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <ry@tinyclouds.org>2009-06-23 11:27:18 +0200
committerRyan <ry@tinyclouds.org>2009-06-23 11:27:18 +0200
commit0e67b34c27755b5258c8a1600ca80b08979ff592 (patch)
treeadeef514710f41c4f34ea17f72ac0b86d90e14e2
parentb9f3ae23cfffbeba5697b652689bc8e51bf0fe63 (diff)
downloadnodejs-0e67b34c27755b5258c8a1600ca80b08979ff592.tar.gz
nodejs-0e67b34c27755b5258c8a1600ca80b08979ff592.tar.bz2
nodejs-0e67b34c27755b5258c8a1600ca80b08979ff592.zip
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.
-rw-r--r--src/file.cc4
-rw-r--r--src/net.cc4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/file.cc b/src/file.cc
index a8f7d4c1b..fc660d5ee 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -34,7 +34,8 @@ using namespace node;
Local<Function> l = Local<Function>::Cast(last_arg); \
callback = new Persistent<Function>(); \
*callback = Persistent<Function>::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 5c3bbb663..04a7fa017 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<Connection*> (req->data);
struct addrinfo *address = NULL,
*address_list = static_cast<struct addrinfo *>(req->ptr2);