(no title)
silverlyra | 1 year ago
When you create a Worker with the worker_threads module, Node spawns a new V8 isolate in the same process: https://github.com/nodejs/node/blob/v20.12.1/src/node_worker...
It’s much more isolation than C threads – the entry point for a thread is a whole module (not a function), and threads must use message passing to communicate. They can share memory, but only via [Shared]ArrayBuffer objects. They're in the same OS process, but each have their own global process object.
But I think it'd meet your need for an in-process isolated execution environment, which you can terminate from the main thread after a timeout.
winrid|1 year ago
kevingadd|1 year ago
silverlyra|1 year ago
But I don't know of any other way this would happen.
jhgg|1 year ago
billywhizz|1 year ago