Skip to content
Advertisement

How to control child-thread lifecycle and synchonize it with main-thread?

I am trying to create another thread that processes data while main thread doing some more. Main thread must wait till another thread finishes doStuff with all elements. And my implementation is pretty straight forward.

Please, take a look at processData and tell me is there some more Java-like way to do it?

I read about Phaser but still can’t imagine how to use it or what else can I try?

JavaScript

Advertisement

Answer

Let me copy the Phaser example from my own post

Main thread

JavaScript

Consumer

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement