• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const timers = require('timers');
5
6{
7  const interval = setInterval(common.mustCall(() => {
8    clearTimeout(interval);
9  }), 1).unref();
10}
11
12{
13  const interval = setInterval(common.mustCall(() => {
14    interval.close();
15  }), 1).unref();
16}
17
18{
19  const interval = setInterval(common.mustCall(() => {
20    timers.unenroll(interval);
21  }), 1).unref();
22}
23
24{
25  const interval = setInterval(common.mustCall(() => {
26    interval._idleTimeout = -1;
27  }), 1).unref();
28}
29
30{
31  const interval = setInterval(common.mustCall(() => {
32    interval._onTimeout = null;
33  }), 1).unref();
34}
35
36// Use timers' intrinsic behavior to keep this open
37// exactly long enough for the problem to manifest.
38//
39// See https://github.com/nodejs/node/issues/9561
40//
41// Since this is added after it will always fire later
42// than the previous timeouts, unrefed or not.
43//
44// Keep the event loop alive for one timeout and then
45// another. Any problems will occur when the second
46// should be called but before it is able to be.
47setTimeout(common.mustCall(() => {
48  setTimeout(common.mustCall(), 1);
49}), 1);
50