Design decisions and trade-offs
...
GUI is designed in a way that all user events are passed and processed by the main thread. The synchronization is done using single global mutex (operated by EnterGuiMutex, LeaveGuiMutex or GuiLock scoped helper). Other threads can directly work with GUI as long they do use this global mutex. There are some operations (like opening/closing windows, message loops) that cannot be performed by any other thread than main.
I propose you to try Reference/GuiLock example. It is simple and clear