Browse Source

Fix ev_async misuse in node_child_process_win32.cc

v0.7.4-release
Bert Belder 14 years ago
parent
commit
8ca0b9a3c5
  1. 15
      src/node_child_process_win32.cc

15
src/node_child_process_win32.cc

@ -375,10 +375,6 @@ void ChildProcess::notify_spawn_failure(ChildProcess *child) {
DWORD result = WaitForSingleObject(watcher_status.lock, INFINITE);
assert(result == WAIT_OBJECT_0);
if (!watcher_status.num_active++) {
ev_async_start(EV_DEFAULT_UC_ &watcher_status.async_watcher);
}
watcher_status.child = child;
ev_async_send(EV_DEFAULT_UC_ &watcher_status.async_watcher);
@ -410,10 +406,6 @@ inline void ChildProcess::watch(ChildProcess *child) {
DWORD result = WaitForSingleObject(watcher_status.lock, INFINITE);
assert(result == WAIT_OBJECT_0);
if (!watcher_status.num_active++) {
ev_async_start(EV_DEFAULT_UC_ &watcher_status.async_watcher);
}
// We must retain the lock here because we don't want the RegisterWait
// to complete before the wait handle is set to the child process.
RegisterWaitForSingleObject(&child->wait_handle_, child->process_handle_,
@ -793,6 +785,11 @@ Handle<Value> ChildProcess::Spawn(const Arguments& args) {
// Grab a reference so it doesn't get GC'ed
child->Ref();
// Start the async watcher
if (!watcher_status.num_active++) {
ev_async_start(EV_DEFAULT_UC_ &watcher_status.async_watcher);
}
eio_custom(do_spawn, EIO_PRI_DEFAULT, after_spawn, (void*)child);
return scope.Close(result);
@ -876,4 +873,4 @@ void ChildProcess::Initialize(Handle<Object> target) {
} // namespace node
NODE_MODULE(node_child_process, node::ChildProcess::Initialize);
NODE_MODULE(node_child_process, node::ChildProcess::Initialize);
Loading…
Cancel
Save