Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored and GeoffreyBooth committed Jan 1, 2023
1 parent a86b4b0 commit b07e12a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/internal/modules/esm/worker.js
Expand Up @@ -3,14 +3,12 @@
const {
ReflectApply,
SafeWeakMap,
Uint8Array,
globalThis: {
Atomics,
},
} = primordials;
const {
ERR_INVALID_RETURN_VALUE,
ERR_OUT_OF_RANGE,
} = require('internal/errors').codes;

// Create this WeakMap in js-land because V8 has no C++ API for WeakMap.
Expand All @@ -19,7 +17,6 @@ internalBinding('module_wrap').callbackMap = new SafeWeakMap();
const {
isMainThread,
workerData: { lock, syncCommPort },
parentPort,
} = require('worker_threads');
if (isMainThread) { return; } // Needed to pass some tests that happen to load this file on the main thread

Expand All @@ -44,7 +41,7 @@ function releaseLock() {
initializationError = exception;
}

parentPort.on('message', handleSyncMessage);
syncCommPort.on('message', handleSyncMessage);

// ! Put as little above this line as possible
releaseLock(); // Send 'ready' signal to main
Expand All @@ -67,9 +64,9 @@ function releaseLock() {

// Send the method response (or exception) to the main thread
try {
parentPort.postMessage(response);
syncCommPort.postMessage(response);
} catch (exception) {
parentPort.postMessage(exception);
syncCommPort.postMessage(exception);
}
releaseLock();
}
Expand Down

0 comments on commit b07e12a

Please sign in to comment.