Re: safely emit signal to main loop (main thread) from worker thread



El jue, 28-01-2010 a las 17:09 -0500, ferar achkar escribiÃ:
How can I safely emit a custom signal from a working thread to gtk main
loop (main thread) to execute a custom call back function connected to
that custom signal.

Not sure if I understand your intention here. In GObject/GTK+, signals
are tied to objects and are "emitted", not "sent" - meaning that the
object does not have any knowledge where (or if) and by whom the signal
is handled. Really, it's pretty much like radio which is broadcasted so
you may tune in (or not), not sent specifically to your receiver.

If all you want is executing some function in the main thread, you maybe
the g_timeout/g_idle functions provide what you're looking for.

With that having said, it is always a good idea to provide some stripped
down source code.

Happy hacking!


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