Files
bun.sh/test/js/node/worker_threads/worker.js
Jarred Sumner 207c7eb509 Implement node:worker_threads (#3923)
* Start to implement `worker_threads`

* more

* more!!

* more

* Update bundle_v2.zig

* delete outdated tests

* `receiveMessageOnPort`

* props test and export default

* fix merge

* not implemented tests

* individual imports

* `receiveMessageOnPort` tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2023-08-02 18:12:12 -07:00

9 lines
261 B
JavaScript

const wt = require("worker_threads");
wt.parentPort.on("message", e => {
let sharedBufferView = new Int32Array(e.sharedBuffer);
wt.workerData.postMessage("done!");
Atomics.add(sharedBufferView, 0, 1);
Atomics.notify(sharedBufferView, 0, Infinity);
});