11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// The actual test here is that the Worker does not keep the main thread 61cb0ef41Sopenharmony_ci// running after it has been .terminate()’ed. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst w = new Worker(` 91cb0ef41Sopenharmony_ciconst p = require('worker_threads').parentPort; 101cb0ef41Sopenharmony_ciwhile(true) p.postMessage({})`, { eval: true }); 111cb0ef41Sopenharmony_ciw.once('message', () => w.terminate()); 121cb0ef41Sopenharmony_ciw.once('exit', common.mustCall()); 13