Re: g_main_loop



A function is just a piece of code, so if you call a function in T1 from T2, you still call it in the context of T2; the only thing really helping here is having a maincontext in T1 and T2, and using a g_idle_add() *on* the maincontext of T1 (but the code that adds it can be called from T2) so the idle handler can call some code with the context of T1.

Am 15. Juli 2008 16:38 schrieb Ed James <edward james gmail com>:
Just a guess, but I'd try putting a function in Thread 1 that emits the signal, but call
that function from Thread 2.  This way, Thread 2 controls when the signal is emitted,
but the signal is still handled by Thread 1.  Never actually tried this myself, though,
so I don't know for sure if one thread can call a function in another thread.

Ed James

2008/7/15 HASWANI HARISH-VCKR47 <harish haswani motorola com>:

Hi All,
 
I am a beginner to gtk APIs.
My query is :
- In Thread T1 I am calling g_main_loop()
- In Thread T2 I am emitting a signal through g_signal_emit_by_name(G_OBJECT, signal-name);
 
I saw that signal handler is running in Thread2 context. I want that it should run in Thread 1 context. How I can achieve this?

 



_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list




--
------------
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]


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