Hi all,
I'm sorry, I guess the question has already been asked, but I can't get any good and working answer regarding this subject.
I've read that gtk functions must only be called within the main thread, otherwise you must "lock" thanks to gdk_threads_enter() and gdk_threads_leave() functions.
I've read that all gtk callbacks are called within the main thread.
Because I have some functions that are sometimes called from callbacks (so the main thread), and sometimes called from other threads, so sometimes I need to lock the thread, and sometimes not..
To solve this, I just created a new thread from within callbacks, but it's still not working properly and does not have the same behaviour on Linux and Windows.
For every callbacks, this is what I tried :
Code:
gboolean my_callback(widget*, gpointer)
{
g_thread_create(my_thread, ...);
}
void my_thread(...)
{
gdk_threads_enter();
/* call to gdk functions */
gdk_threads_leave();
}
But I still get some application locks (windows are freezing) ...
Any help ? Any tutorial for the REAL and PORTABLE way to work with gtk threads ?
Thanks for help. Best regards, Vincent.