Re: GTK deadlock in gtk_main

2010-08-04 Thread Gabriele Greco
2010/8/3 Tomas Soltys > All right, so at the end it was my bug :) > > Thank you all for your explanations. > > Note also that part of the magic of gdk_threads_enter/leave that you can use on unix to use gtk functions in subthreads does not work on win32 (and also on OSX). I had really some bad h

Re: GTK deadlock in gtk_main

2010-08-03 Thread Tomas Soltys
All right, so at the end it was my bug :) Thank you all for your explanations. Cheers, Tomas > Hi. > >> So what you suggest is to have gdk_threads_enter and gdk_threads_leave >> at >> the beginning and at the end of the idle function? >> >> Is this really intended? > > Yes, this is how things sh

Re: GTK deadlock in gtk_main

2010-08-03 Thread KC
2010/8/4 Tomas Soltys : > Hi, > > So what you suggest is to have gdk_threads_enter and gdk_threads_leave at > the beginning and at the end of the idle function? > > Is this really intended? YES, check http://library.gnome.org/devel/gdk/unstable/gdk3-Threads.html Idles, timeouts, and input function

Re: GTK deadlock in gtk_main

2010-08-03 Thread Tadej Borovšak
Hi. > So what you suggest is to have gdk_threads_enter and gdk_threads_leave at > the beginning and at the end of the idle function? > > Is this really intended? Yes, this is how things should be done. But for your convenience, GDK provides a function that will wrap your idle callback in lock/unl

Re: GTK deadlock in gtk_main

2010-08-03 Thread Tomas Soltys
Hi, So what you suggest is to have gdk_threads_enter and gdk_threads_leave at the beginning and at the end of the idle function? Is this really intended? Anyway, thanks for your help. Regards, Tomas > Hi. > > You're having troubles because gtk_main_iteration_do() does it's own > unlock/lock cy

Re: GTK deadlock in gtk_main

2010-08-03 Thread Tadej Borovšak
Hi. You're having troubles because gtk_main_iteration_do() does it's own unlock/lock cycle. When your idle callback is executed, your mutex is unlocked. gtk_main_iteration_do() "unlocks" it again, executes whatever is there to be executed and locks it. Now control returns back to main loop, which

GTK deadlock in gtk_main

2010-08-03 Thread Tomas Soltys
Hi all, I am not sure if this is a bug or just my misunderstanding of how the synchronization is done in GTK. Below is a simple "test.c" example in which the deadlock occurs. Basically program deadlocks itself when "idle_func" is done and control is returned to "gtk_main". Thanks for your help