xref: /third_party/node/test/sequential/test-timers-block-eventloop.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/sequential/
11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst { sleep } = require('internal/util');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cilet called = false;
91cb0ef41Sopenharmony_ciconst t1 = setInterval(() => {
101cb0ef41Sopenharmony_ci  assert(!called);
111cb0ef41Sopenharmony_ci  called = true;
121cb0ef41Sopenharmony_ci  setImmediate(common.mustCall(() => {
131cb0ef41Sopenharmony_ci    clearInterval(t1);
141cb0ef41Sopenharmony_ci    clearInterval(t2);
151cb0ef41Sopenharmony_ci  }));
161cb0ef41Sopenharmony_ci}, 10);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciconst t2 = setInterval(() => {
191cb0ef41Sopenharmony_ci  sleep(20);
201cb0ef41Sopenharmony_ci}, 10);
21

Indexes created Thu Nov 07 10:32:03 CST 2024