Re: signals and threads
- From: Daniel Atallah <daniel atallah gmail com>
- To: "Dmitry A. Yanko" <fm cross-road org ua>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: signals and threads
- Date: Wed, 7 Dec 2005 11:56:48 -0500
On 12/7/05, Dmitry A. Yanko <fm cross-road org ua> wrote:
On Mon, Dec 05, 2005 at 01:50:40PM -0500, Tristan Van Berkom wrote:
You can use g_idle_add() to trigger your UI updates from your data
processing threads.
Every signal callback registered to a GSignal will be called
when that signal is emitted, in the thread context in which
the signal was emitted, period.
Well... Now i use g_idle_add() for UI init. It works.
Can i use function like gtk_text_buffer_insert_at_cursor(),
gtk_text_buffer_place_cursor() from another thread? All data passed correctly.
It seems working for me (with gdk_thread_enter/leave). But is it rigth way?
Or i still need to use g_idle_add() for any textbuffer manipulation?
I think you misunderstood my original posting.
No UI manipulation (including textbuffer manipulation, etc) may be
done from outside the main thread.
My app architecture:
Main:
g_thread_init();
gdk_threads_init();
Thread_A:
gtk_init();
gtk_main();
This is wrong, gtk_init() and gtk_main() should be in the main thread.
Thread_B:
g_idle_add(); - create window, set and unset signal handlers
direct texbuffer manipulation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]