Logo
Explore Help
Sign In
1berry/nodejs
1
0
Fork 0
You've already forked nodejs
Code Issues Packages Projects Releases Wiki Activity
nodejs/test/parallel/test-timers-unref-call.js

12 lines
306 B
JavaScript
Raw Normal View History

lib: fix guard expression in timer.unref() Fixes the following assertion on slow systems, like our ARM buildbot: $ out/Debug/node test/simple/test-timers-unref.js node: ../src/async-wrap-inl.h:101: v8::Handle<v8::Value> node::AsyncWrap::MakeCallback(uint32_t, int, v8::Handle<v8::Value>*): Assertion `cb_v->IsFunction()' failed. Aborted The reason it only manifests on slow systems is that the test starts a 1 ms interval timer, then defers timer.unref.bind({}) to the next tick. On fast systems, the test completes in under a millisecond, before the callback is called. This commit makes timer.unref() check that the receiver actually has a timeout callback property. Fixes #13. PR-URL: https://github.com/iojs/io.js/pull/165 Reviewed-By: Rod Vagg <rod@vagg.org>
2014-12-15 17:25:31 +01:00
var common = require('../common');
var Timer = process.binding('timer_wrap').Timer;
Timer.now = function() { return ++Timer.now.ticks; };
Timer.now.ticks = 0;
var t = setInterval(function() {}, 1);
var o = { _idleStart: 0, _idleTimeout: 1 };
t.unref.call(o);
setTimeout(clearInterval.bind(null, t), 2);
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 627ms Template: 8ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API