Skip to content

Commit

Permalink
Fix thread pool unref issue.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ry committed Jun 23, 2009
1 parent b9f3ae2 commit 0e67b34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand All @@ -47,6 +48,7 @@ do { \
node::FatalException(try_catch); \
delete callback; \
} \
ev_unref(EV_DEFAULT_UC); \
} while(0)

#define DEFINE_SIMPLE_CB(name) \
Expand Down
4 changes: 4 additions & 0 deletions src/net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0e67b34

Please sign in to comment.