Re: signals and threads
- From: "Dmitry A. Yanko" <fm cross-road org ua>
- To: Tristan Van Berkom <tvb gnome org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: signals and threads
- Date: Wed, 7 Dec 2005 18:31:26 +0200
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?
In which way i must to shutdown window (not app, not gtk at all)?
Now i got strange error, like this:
Gtk-ERROR **: file gtktextview.c: line 2669 (gtk_text_view_set_property):
should not be reached
aborting...
Signal handlers are manually disconnected at that moment.
I need to close thread. And i don't understand this error
reason, because there are no any UI updates at that moment and all signals are
disconnected.
My app architecture:
Main:
g_thread_init();
gdk_threads_init();
Thread_A:
gtk_init();
gtk_main();
Thread_B:
g_idle_add(); - create window, set and unset signal handlers
direct texbuffer manipulation
I create thread B on external event, and need to shutdown it on the user
action. Then my app waits for another external event or many.
BTW, Can i use pthread calls? Or i need to use only glib thread support?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]