This question is about the webworker-threadsnode.js module .
The documentation for the module is webworker-threadsvery limited, and I can not find any new examples that will help you achieve your goal.
Simply put, I have two intensive CPU functions that need to be run at the same time and must return the result and print it as soon as they end. Since these synchronous methods are blocked, my current model is this:

I am trying to achieve this:

However, I am not an expert, and I cannot think of translating the information provided in Readme.md for the web workflow module into my own situation.
My current hack code is this:
var Worker = require('webworker-threads').Worker;
var worker = new Worker(function(){
onmessage = function(event) {
postMessage(event.data);
self.close();
};
});
worker.onmessage = function(event) {
console.log("Worker1 said : " + event.data);
};
worker.postMessage(work());
var worker2 = new Worker(function(){
onmessage = function(event) {
postMessage(event.data);
self.close();
};
});
worker2.onmessage = function(event) {
console.log("Worker2 said : " + event.data);
};
worker2.postMessage(work2());
function work(){
var total = 0;
for (var i=0; i<430046534; i++){
total += (i*i*i);
}
return total;
}
function work2(){
var total = 0;
for (var i=0; i<630746533; i++){
total += (i*i*i);
}
return total;
}
, , , , , .