Re: [Vala] signal handling in gui thread



On Sat, Jan 30, 2010 at 02:20:13 +0100, Jiří Zárevúcky wrote:
Nor Jaidi Tuah píše v So 30. 01. 2010 v 09:07 +0800:

[...]

So, I emulate gtkmm's Dispatcher by replacing this:

  a_signal.connect ((arg) => { things_to_do (); });

with:

  a_signal.connect ((arg) => { 
     Idle.add_full (Priority.HIGH, () => things_to_do (); });
  });

Seems to work fine. I began to wonder why the gtkmm's
Dispatcher makes contorted use of pipes.


Performance reasons, most likely.

I would not think so, even though it might have some slight advantage (adding
source to other thread's GLib.MainContext does involve some locks while pipes
do not). Rather I would expect it either pre-dates some important API changes
regarding threads and main loops in GLib (it used to miss a couple of things
and working with non-default contexts is still a bit unwieldy), or the author
didn't think about this method.

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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