I’ve got a couple background threads that talk to a server and I’m trying to understand the best way to cause the results of those thread activities to trigger GUI changes, like a dialog box popping up, etc. I read quite a bit about not using MessageManager::callFunctionOnMessageThread() from any background threads, so i’m at a bit of a stopping point figuring out how to get this to work without blocking.
What i’ve got happening in my app is when the user clicks on a menu item, a window appears which spawns a couple background threads to retrieve some data from a server. Those threads trigger callbacks in the window to populate the window’s objects with the data. When the user selects one of the objects and clicks a button in the window, the threads for talking to the server are started up again. when those threads finish what they’re doing, they trigger callBacks to the window, which result in Save dialog boxes. The problem i’m running into is that these server threads are the ones that are triggering these dialog boxes, which you can’t do as they’re not the MessageManager thread.
What’s the correct way to tell the MessageManager to do some UI things (dialog boxes, save windows, etc) from threads other than the MessageManager thread?