-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: support V8 experimental shared values in messaging
PR-URL: #47706 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Loading branch information
Showing
3 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
// Flags: --harmony-struct | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const { Worker, parentPort } = require('worker_threads'); | ||
|
||
// Do not use isMainThread so that this test itself can be run inside a Worker. | ||
if (!process.env.HAS_STARTED_WORKER) { | ||
process.env.HAS_STARTED_WORKER = 1; | ||
const m = new globalThis.SharedArray(16); | ||
|
||
const worker = new Worker(__filename); | ||
worker.once('message', common.mustCall((message) => { | ||
assert.strictEqual(message, m); | ||
})); | ||
|
||
worker.postMessage(m); | ||
} else { | ||
parentPort.once('message', common.mustCall((message) => { | ||
// Simple echo. | ||
parentPort.postMessage(message); | ||
})); | ||
} |