Re: gdk threads ...





On Mon, May 21, 2012 at 9:00 AM, Michael Meeks <michael meeks suse com> wrote:

       Windows, has this rather nice 'SendMessage' abstraction that hides that
synchronous cross-thread blocking fun,

its really not significantly different from g_idle_add(), except that SendMessage relies on a switch() on the other side (in the GUI event loop) to decide what to execute, rather being given the actual callback/functor/closure to execute. i much prefer the latter design - having to add a new case to a switch() statement every time i come with something else i need the GUI event loop to do from time to time is a PITA.

in ardour, where we have the facilities of C++ at our disposal, any thread can call:

               GtkUI::call_slot (sigc::mem_fun (*someObject, &SomeObject::some_method));

or even

               GtkUI::call_slot (sigc::bind (sigc::mem_fun (*someObject, &SomeObject::some_method_with_args), arg1, arg2);

and the right thing will happen. no need for wrapper structures etc. alas, this is not available in the same simple way for C programming.
 
       On the other hand I am -still- grasping at a benefit that justifies a
radical re-structuring of our gtk+ backends, and attendant code churn,
and curious performance.

your code is designed around the execution of GDK/GTK code in multiple threads. it was unfortunate that GDK/GTK ever allowed this (as has been pointed out, this is absolutely NOT possible on Windows with violating several fundamental parts of the Windows API). GDK/GTK is now correcting this design error. its never nice to find out that you've got a code design that is (a) identified as a mistake (b) gets removed, but such things do happen, and in my experience they are necessary to avoid bit rot.

asking that a toolkit maintains functionality that has been identified as erroneous to avoid one or two apps from having to do code restructuring is a bit much, if you ask me. i understand the pain (i still have vivid memories of the transition from gtk1 to gtk2), but sometimes i think you just have to swallow the tablets and get on with it.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]