From http://developer.gnome.org/gdk/unstable/gdk-Threads.html
With the Win32 backend, GDK calls should not be attempted from
multiple threads at all.
But how to avoid freezing of an interface?
For example, I have a callback for a button that gets virtual machine names from host and add it row by row to Tree List View. I create pthread that do it and adds rows.
Sometimes List View became garbaged (some cells became blank), after it all application behave the same (all dialogs etc)
As in WIN32 multi-threading is impossible, what can I do to simulate it or avoid such issues?
The easiest way is to do a thread as you are doing and from there add whatever you want to pass to the GUI to a global container. Then call
g_idle_add()to schedule a function that will read this container and update the GUI; the idle callback will be called from the GUI thread.Two things to be aware of:
g_thread_init()orgdk_thread_init()in the initialization of your program to make glib thread-safe.