Forces
GUI code needs to responsive to input while work is being done. We want to encapsulate the information needed to perform a job. We're in C++ Windows/Mac where certain issue constrain what gui threads and non-gui threads can do.
Therefore:
Use threaded command object (which is WHAT, exactly?) to do the work. See also CommandPattern, CommandObject.
To keep application thread-safe, avoid calling functions in the model while the threaded command object is running.
An issue in MicrosoftWindows is that a GUI thread cannot safely call mutex, semaphores, etc. that could force the thread to wait, unless you use MsgWaitForMultipleObjects, which includes the thread's window message queue as one of the objects to wait on, otherwise there could be deadlock if the GUI thread has to wait on a mutex while the operating system tries to send an event to its window.
MacOs 9 preemptive threads cannot call GUI functions at all (they used to not be able to do much at all except image processing - that changed several years ago). They can make network calls, and maybe file system and other non-GUI calls. On MacOS 9, it is safe for the main (GUI) thread to wait on a semaphore, because the OS integrated theGUI-event-polling mechanism with the semaphore system.
SwingUtilities?.invokeLater()?
MacOsx GUIs (Carbon and Cocoa) are also not thread-safe: only the main thread should do anything in the GUI.