summaryrefslogtreecommitdiff
path: root/lib/timers.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/timers.js')
-rw-r--r--lib/timers.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/timers.js b/lib/timers.js
index 68e3e65e9..041fe031c 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -284,6 +284,14 @@ var Timeout = function(after) {
this._repeat = false;
};
+
+function unrefdHandle() {
+ this.owner._onTimeout();
+ if (!this.owner._repeat)
+ this.owner.close();
+}
+
+
Timeout.prototype.unref = function() {
if (!this._handle) {
var now = Timer.now();
@@ -292,6 +300,7 @@ Timeout.prototype.unref = function() {
if (delay < 0) delay = 0;
exports.unenroll(this);
this._handle = new Timer();
+ this._handle.owner = this;
this._handle[kOnTimeout] = this._onTimeout;
this._handle.start(delay, 0);
this._handle.domain = this.domain;