Juce Application/GUI thread and worker thread communications

Hello! I have search this subject on forum, but I don’t professional in threads between GUI and other threads (worker threads).
I develop Jabber client and create all Jabber logic (by gloox library) in worker thread.
I inherit GUI Component (like LoginComponent with login and password text editors) on gloox ConnectionListener and handle it onConnect() at my GUI Component.
Now I want update my GUI Component (LoginComponent) but onConnect() work at worker thread, and i get assert into CHECK_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN

void Component::setBounds (const int x, const int y, int w, int h)
// if component methods are being called from threads other than the message
// thread, you’ll need to use a MessageManagerLock object to make sure it’s thread-safe.

I try MessageManager::getInstance()->broadcastMessage().
Maybe ChangeBroadcaster/ChangeListener?
How to communicate between worker thread and GUI thread to change GUI appearance?


Hm, I’m idiot!

void LoginComponent::onConnect()
const MessageManagerLock mmLock;
// the event loop will now be locked so it’s safe to make a few calls…

// .. change GUI

// ..the event loop will now be unlocked as the MessageManagerLock goes out of scope


Have a look at SimpleDJ in my signature.

Thank you. But it too difficult for me to understand this project. Have you simple tutorial of using your VFLib?
But I have a look at SimpleDJ still… :roll:

I don’t use VFLib or another libraries. Only Juce.
I only inherits my component on juce::MessageListener and handle it handleMessage() method.
And it’s work! :oops: