diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-03-04 04:27:58 +0400 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-03-04 04:27:58 +0400 |
commit | 06453a94a7b06df30be0148e8b1d89932350f677 (patch) | |
tree | b87a1a4a98787d46e899155486870933fecd703a /src | |
parent | 47abdd9c43ae97ed11cb8cc4c770b43043718308 (diff) |
src: domain should not replace nextTick function
Previously if you cached process.nextTick and then require('domain')
subsequent nextTick() calls would not be caught because enqueued
functions were taking the wrong path. This keeps nextTick to a single
function reference and changes the implementation details after domain
has been required.
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 2 | ||||
-rw-r--r-- | src/node.js | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/node.cc b/src/node.cc index a18e0d89d5c..ac906f0cd5c 100644 --- a/src/node.cc +++ b/src/node.cc @@ -918,7 +918,7 @@ Handle<Value> UsingDomains(const Arguments& args) { Local<Function> tdc = tdc_v.As<Function>(); Local<Function> ndt = ndt_v.As<Function>(); process->Set(String::New("_tickCallback"), tdc); - process->Set(String::New("nextTick"), ndt); + process->Set(String::New("_currentTickHandler"), ndt); process_tickCallback.Dispose(); // Possibly already set by MakeCallback(). process_tickCallback = Persistent<Function>::New(tdc); return Undefined(); diff --git a/src/node.js b/src/node.js index bdbe1c5e16d..b54ff51752a 100644 --- a/src/node.js +++ b/src/node.js @@ -331,8 +331,12 @@ var index = 1; var depth = 2; - process.nextTick = nextTick; + process.nextTick = function nextTick(cb) { + process._currentTickHandler(cb); + }; + // needs to be accessible from cc land + process._currentTickHandler = _nextTick; process._nextDomainTick = _nextDomainTick; process._tickCallback = _tickCallback; process._tickDomainCallback = _tickDomainCallback; @@ -472,7 +476,7 @@ tickDone(0); } - function nextTick(callback) { + function _nextTick(callback) { // on the way out, don't bother. it won't get fired anyway. if (process._exiting) return; |