| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dc69cbe commit a574cb0
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,11 +45,6 @@ tasks. | |||
| 45 | 45 | ||
| 46 | 46 | Takes `whitelist` and concats that with predefined `knownGlobals`. | |
| 47 | 47 | ||
| 48 | - ### busyLoop(time) | ||
| 49 | - * `time` [<number>][] | ||
| 50 | - | ||
| 51 | - Blocks for `time` amount of time. | ||
| 52 | - | ||
| 53 | 48 | ### canCreateSymLink() | |
| 54 | 49 | * return [<boolean>][] | |
| 55 | 50 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -481,12 +481,6 @@ function nodeProcessAborted(exitCode, signal) { | |||
| 481 | 481 | } | |
| 482 | 482 | } | |
| 483 | 483 | ||
| 484 | - function busyLoop(time) { | ||
| 485 | - const startTime = Date.now(); | ||
| 486 | - const stopTime = startTime + time; | ||
| 487 | - while (Date.now() < stopTime) {} | ||
| 488 | - } | ||
| 489 | - | ||
| 490 | 484 | function isAlive(pid) { | |
| 491 | 485 | try { | |
| 492 | 486 | process.kill(pid, 'SIGCONT'); | |
@@ -744,7 +738,6 @@ function runWithInvalidFD(func) { | |||
| 744 | 738 | module.exports = { | |
| 745 | 739 | allowGlobals, | |
| 746 | 740 | buildType, | |
| 747 | - busyLoop, | ||
| 748 | 741 | canCreateSymLink, | |
| 749 | 742 | childShouldThrowAndAbort, | |
| 750 | 743 | createZeroFilledFile, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,6 @@ const { | |||
| 39 | 39 | skip, | |
| 40 | 40 | ArrayStream, | |
| 41 | 41 | nodeProcessAborted, | |
| 42 | - busyLoop, | ||
| 43 | 42 | isAlive, | |
| 44 | 43 | expectWarning, | |
| 45 | 44 | expectsError, | |
@@ -86,7 +85,6 @@ export { | |||
| 86 | 85 | skip, | |
| 87 | 86 | ArrayStream, | |
| 88 | 87 | nodeProcessAborted, | |
| 89 | - busyLoop, | ||
| 90 | 88 | isAlive, | |
| 91 | 89 | expectWarning, | |
| 92 | 90 | expectsError, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 1 | 2 | 'use strict'; | |
| 2 | 3 | ||
| 3 | - const common = require('../common'); | ||
| 4 | + require('../common'); | ||
| 4 | 5 | const assert = require('assert'); | |
| 6 | + const { sleep } = require('internal/util'); | ||
| 5 | 7 | ||
| 6 | 8 | // Make sure we test 0ms timers, since they would had always wanted to run on | |
| 7 | 9 | // the current tick, and greater than 0ms timers, for scenarios where the | |
@@ -23,7 +25,7 @@ scenarios.forEach(function(delay) { | |||
| 23 | 25 | ||
| 24 | 26 | // Busy loop for the same timeout used for the nested timer to ensure that | |
| 25 | 27 | // we are in fact expiring the nested timer. | |
| 26 | - common.busyLoop(delay); | ||
| 28 | + sleep(delay); | ||
| 27 | 29 | ||
| 28 | 30 | // The purpose of running this assert in nextTick is to make sure it runs | |
| 29 | 31 | // after A but before the next iteration of the libuv event loop. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,8 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 1 | 2 | 'use strict'; | |
| 2 | 3 | ||
| 3 | 4 | const common = require('../common'); | |
| 5 | + const { sleep } = require('internal/util'); | ||
| 4 | 6 | ||
| 5 | 7 | // This test verifies that the next tick queue runs after each | |
| 6 | 8 | // individual Timeout, as well as each individual Immediate. | |
@@ -16,7 +18,7 @@ const t2 = setTimeout(common.mustNotCall(), 1); | |||
| 16 | 18 | const t3 = setTimeout(common.mustNotCall(), 1); | |
| 17 | 19 | setTimeout(common.mustCall(), 1); | |
| 18 | 20 | ||
| 19 | - common.busyLoop(5); | ||
| 21 | + sleep(5); | ||
| 20 | 22 | ||
| 21 | 23 | setImmediate(common.mustCall(() => { | |
| 22 | 24 | process.nextTick(() => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,12 @@ | |||
| 1 | - // Flags: --expose-gc | ||
| 1 | + // Flags: --expose-gc --expose-internals | ||
| 2 | 2 | 'use strict'; | |
| 3 | 3 | ||
| 4 | 4 | const common = require('../common'); | |
| 5 | 5 | const assert = require('assert'); | |
| 6 | 6 | const { | |
| 7 | 7 | monitorEventLoopDelay | |
| 8 | 8 | } = require('perf_hooks'); | |
| 9 | + const { sleep } = require('internal/util'); | ||
| 9 | 10 | ||
| 10 | 11 | { | |
| 11 | 12 | const histogram = monitorEventLoopDelay(); | |
@@ -54,7 +55,7 @@ const { | |||
| 54 | 55 | histogram.enable(); | |
| 55 | 56 | let m = 5; | |
| 56 | 57 | function spinAWhile() { | |
| 57 | - common.busyLoop(1000); | ||
| 58 | + sleep(1000); | ||
| 58 | 59 | if (--m > 0) { | |
| 59 | 60 | setTimeout(spinAWhile, common.platformTimeout(500)); | |
| 60 | 61 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 1 | 2 | 'use strict'; | |
| 2 | 3 | ||
| 3 | 4 | const common = require('../common'); | |
| 4 | 5 | const assert = require('assert'); | |
| 6 | + const { sleep } = require('internal/util'); | ||
| 5 | 7 | ||
| 6 | 8 | let called = false; | |
| 7 | 9 | const t1 = setInterval(() => { | |
@@ -14,5 +16,5 @@ const t1 = setInterval(() => { | |||
| 14 | 16 | }, 10); | |
| 15 | 17 | ||
| 16 | 18 | const t2 = setInterval(() => { | |
| 17 | - common.busyLoop(20); | ||
| 19 | + sleep(20); | ||
| 18 | 20 | }, 10); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 1 | 2 | 'use strict'; | |
| 2 | 3 | ||
| 3 | 4 | /* | |
@@ -25,6 +26,7 @@ | |||
| 25 | 26 | ||
| 26 | 27 | const common = require('../common'); | |
| 27 | 28 | const assert = require('assert'); | |
| 29 | + const { sleep } = require('internal/util'); | ||
| 28 | 30 | ||
| 29 | 31 | const TIMEOUT = 100; | |
| 30 | 32 | ||
@@ -65,7 +67,7 @@ function blockingCallback(retry, callback) { | |||
| 65 | 67 | return callback(); | |
| 66 | 68 | } else { | |
| 67 | 69 | // Block by busy-looping to trigger the issue | |
| 68 | - common.busyLoop(TIMEOUT); | ||
| 70 | + sleep(TIMEOUT); | ||
| 69 | 71 | ||
| 70 | 72 | timeCallbackScheduled = Date.now(); | |
| 71 | 73 | setTimeout(blockingCallback.bind(null, retry, callback), TIMEOUT); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,15 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 1 | 2 | 'use strict'; | |
| 2 | - const common = require('../common'); | ||
| 3 | + require('../common'); | ||
| 3 | 4 | const assert = require('assert'); | |
| 5 | + const { sleep } = require('internal/util'); | ||
| 4 | 6 | ||
| 5 | 7 | let cntr = 0; | |
| 6 | 8 | let first; | |
| 7 | 9 | const t = setInterval(() => { | |
| 8 | 10 | cntr++; | |
| 9 | 11 | if (cntr === 1) { | |
| 10 | - common.busyLoop(100); | ||
| 12 | + sleep(100); | ||
| 11 | 13 | // Ensure that the event loop passes before the second interval | |
| 12 | 14 | setImmediate(() => assert.strictEqual(cntr, 1)); | |
| 13 | 15 | first = Date.now(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments