Re: [Vala] signal handling in gui thread

Nor Jaidi Tuah píše v Út 26. 01. 2010 v 11:39 +0800:
In gtkmm there is a class called Dispatcher that
works like the usual glib signal except that the
handler is executed in, typically, the gui thread.
This avoids a lot of ugly sync locks. I wonder if there
is something equivalent in vala.

Nor Jaidi Tuah

I think there is nothing equivalent in GLib, but you can use
GLib.Idle.add to either simply dispatch your thread-unsafe code in the
main loop, or create your own dispatcher class (probably more
efficient), possibly also using GLib.AsyncQueue (which is thread-safe).
Note that I actually don't have much experience with threading in GTK,
so this is just an educated guess here. Perhaps there are better things
to do what you need.

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

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