Synchronize main Thread with worker Thread
Hi, in my current project I receive data from the network. This data is beeing preprocessed in a worker thread. In the end the worker thread creates a list of data-elements which have to be used by a Singleton in my Unity MainThread. The question is, what is best practice in this case to share the ressource (the List) between the worker-thread which creates and updates it and the Main-Thread which visualizes the data.
I already came across a lot of possible solutions during my research, including booleans as flags, using a Dispatcher or basically locking the object from both sides (unity thread and worker thread). Since I am not really experienced with threading so far, I am not sure which solution would fit best.
For me, code-performance is really important, because my target device is HoloLens2.
Your answer
Follow this Question
Related Questions
Loading textures without freezing at runtime 0 Answers
Why Is This Coroutine Freezing my Unity5 editor? 2 Answers
new Thread seems to be working on main thread ( freezing screen ) 0 Answers
Using BackgroundWorker with Unity, Completed not running on Main thread ? 1 Answer
How can I thread this function? 0 Answers