I am currently working with Web Workers and for some testing purposes it would be nice if it was possible to wait in the main thread until workers have finished what they're doing. So:
Main thread -> start workers
Main thread -> wait for workers to finish
workers -> do some work
Workers finish.
Main thread -> do some stuff.
I realize the most correct way of doing this is using a callback in the main thread that is called whenever a worker finishes but this will not work for practical reasons. I've made what is similar to a CyclicBarrier in Java but whenever I call barrier.enter() in the main thread I of course get an error. Hence what I want to know is if there's any setting or something similar I can set which temporarily allows me to block on the main thread. I'm running my program using Node btw.
This is purely for testing purposes, I would of course never use this in a production environment!