11cb0ef41Sopenharmony_ci// Flags: --no-harmony-atomics 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci'use strict'; 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst common = require('../common'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci// Regression test for https://github.com/nodejs/node/issues/39717. 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci// Do not use isMainThread so that this test itself can be run inside a Worker. 121cb0ef41Sopenharmony_ciif (!process.env.HAS_STARTED_WORKER) { 131cb0ef41Sopenharmony_ci process.env.HAS_STARTED_WORKER = 1; 141cb0ef41Sopenharmony_ci const w = new Worker(__filename); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci w.on('exit', common.mustCall((status) => { 171cb0ef41Sopenharmony_ci assert.strictEqual(status, 2); 181cb0ef41Sopenharmony_ci })); 191cb0ef41Sopenharmony_ci} else { 201cb0ef41Sopenharmony_ci process.exit(2); 211cb0ef41Sopenharmony_ci} 22