dimanche 12 mai 2019

Multithreaded GUI update() methods

I'm begginer in multithreading. I recently started to writing something like multithreaded observer. I need some clarification.

Let's say I'm working with Subject, and I'm changing its state. Then Observers (in example - GUI widgets) have to be notified, so they could perform thei update () method.

And there is my question: how am i handling those getValue () performed by many Observers? If it's just a getter for some variable, do i have to run it in new thread? Does it require any locking?

Or mayby there is a metod to just send those new value to GUI thread, and letting widgets there access those value. And again, can it be a single loop, or do i have to create another threads for every widget to get those value?

Aucun commentaire:

Enregistrer un commentaire