title: Is it possible to allow waiting in the main thread in javascript
body: <p>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:</p>
  
  <p>Main thread -> start workers</p>
  
  <p>Main thread -> wait for workers to finish</p>
  
  <p>workers -> do some work</p>
  
  <p>Workers finish.</p>
  
  <p>Main thread -> do some stuff.</p>
  
  <p>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.</p>
  
  <p>This is purely for testing purposes, I would of course never use this in a production environment!</p>