diff options
author | Rich Trott <rtrott@gmail.com> | 2019-01-09 15:36:24 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-01-11 18:06:11 -0800 |
commit | 9e62bb54b38022bbf0b39385b6adaf2f6aab0654 (patch) | |
tree | 530455a1975f6f2a3f184f7c2a11ba39dce5389b /test | |
parent | cf9bcdeabe1cac2c19785183e9f34e1a01cb9047 (diff) | |
download | android-node-v8-9e62bb54b38022bbf0b39385b6adaf2f6aab0654.tar.gz android-node-v8-9e62bb54b38022bbf0b39385b6adaf2f6aab0654.tar.bz2 android-node-v8-9e62bb54b38022bbf0b39385b6adaf2f6aab0654.zip |
test,worker: simplify common.isMainThread
Now that `worker_threads` do not require a flag, the logic around
loading `isMainThread` can be removed.
PR-URL: https://github.com/nodejs/node/pull/25426
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/common/index.js | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/test/common/index.js b/test/common/index.js index eff5f47e89..c1fb28121e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -46,13 +46,7 @@ const noop = () => {}; const hasCrypto = Boolean(process.versions.openssl); -const isMainThread = (() => { - if (require('module').builtinModules.includes('worker_threads')) { - return require('worker_threads').isMainThread; - } - // Worker module not enabled → only a single main thread exists. - return true; -})(); +const { isMainThread } = require('worker_threads'); // Check for flags. Skip this for workers (both, the `cluster` module and // `worker_threads`) and child processes. |