Yes, you can run two separate gtk_main() loops in separate threads. However, you can only run GTK+ in one thread at a time. Therefore, you will need to use gdk_threads_enter()/leave().
Ok let me try again. Instead of using the gtk_main() I use the glib main loop. No GTK+ involved. Is it possible to do what I tried to explain then? In that case, how?
Two threads, but with their own mainloops (glib ones) running independently of each other, communicating THREAD SAFE only through signaling eachother. E.g all communication between the thread is done through asynchronous calls pushing events to the other threads mainloop event queue. Each mainloop waits for events from the other thread (and of course other events attached to the independent mainloops).
Let me start at a more basic question: assuming I run a mainloop on one thread, is it possible to (thread safe) issue an event that execute some code on that thread from another thread without using gdk_threads_enter() ?
something like: g_send_event_on_other_mainloop(othermainloop, event) or something?
Btw, Foundations of GTK+ is a good book. Got it on the desk here :) Unfortunately its not that into the lowlevels of glib as I wish to discover here :P