Re: signals and threads

2005-12-08 Thread Dmitry A. Yanko
On Wed, Dec 07, 2005 at 11:56:48AM -0500, Daniel Atallah wrote: > This is wrong, gtk_init() and gtk_main() should be in the main thread. I rewrote a little my app. It's fine now. Thanks to all for your help. ___ gtk-app-devel-list mailing list gtk-app-de

Re: signals and threads

2005-12-07 Thread Tristan Van Berkom
Dmitry A. Yanko wrote: [...] Its better to use the gthread api only; while using pthreads directly might work, it wont be portable & it wont be garaunteed to work properly either. Ok. What about a sockets and file io? Glib has such support, but it's more convenient for me to make direct calls

Re: signals and threads

2005-12-07 Thread John Cupitt
On 12/7/05, Dmitry A. Yanko <[EMAIL PROTECTED]> wrote: > On Wed, Dec 07, 2005 at 12:46:28PM -0500, Tristan Van Berkom wrote: > > May I just ask why you think you need to use threads in the > > first place ? > It is more convenient. :) > It is difficult to handle many external events whithout thread

Re: signals and threads

2005-12-07 Thread Dmitry A. Yanko
On Wed, Dec 07, 2005 at 12:46:28PM -0500, Tristan Van Berkom wrote: > May I just ask why you think you need to use threads in the > first place ? It is more convenient. :) It is difficult to handle many external events whithout threads. Each event (data stream) needs own window and set of widgets (

Re: signals and threads

2005-12-07 Thread Daniel Atallah
On 12/7/05, Dmitry A. Yanko <[EMAIL PROTECTED]> 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 > > wh

Re: signals and threads

2005-12-07 Thread Tristan Van Berkom
Dmitry A. Yanko wrote: On Mon, Dec 05, 2005 at 01:50:40PM -0500, Tristan Van Berkom wrote: [...] My app architecture: Main: g_thread_init(); gdk_threads_init(); Thread_A: gtk_init(); gtk_main(); Thread_B: g_idle_add(); - create window,

Re: signals and threads

2005-12-07 Thread Dmitry A. Yanko
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 si

Re: signals and threads

2005-12-05 Thread Tristan Van Berkom
Dmitry A. Yanko wrote: On Mon, Dec 05, 2005 at 11:55:57AM -0500, Daniel Atallah wrote: You can use g_idle_add() to trigger your UI updates from your data processing threads. Ok. Thanks a lot. I will try. Will it also resolve my hignal handlers problem? Every signal callback registered to a

Re: signals and threads

2005-12-05 Thread Dmitry A. Yanko
On Mon, Dec 05, 2005 at 11:55:57AM -0500, Daniel Atallah wrote: > You can use g_idle_add() to trigger your UI updates from your data > processing threads. Ok. Thanks a lot. I will try. Will it also resolve my hignal handlers problem? ___ gtk-app-devel-li

Re: signals and threads

2005-12-05 Thread Dmitry A. Yanko
On Mon, Dec 05, 2005 at 12:20:01PM -0500, Tristan Van Berkom wrote: > >Output: > >tid: 0x8003 app->text_buffer_my: 0xb661ec18 > >tid: 0x4002 app->text_buffer_my: 0xb6627e40 > >... > >0x4002's "insert-text" with 0x4002 signal handler(to access thread specific > >data and handle input properly). How

Re: signals and threads

2005-12-05 Thread Daniel Atallah
On 12/5/05, Dmitry A. Yanko <[EMAIL PROTECTED]> wrote: > Hi! > > I develop the app, that needs to run 2 same windows, each in separate thread. > I have a same signal handlers in each thread. The difference is only in thread > specific data, because i need to make a different things in different thr

Re: signals and threads

2005-12-05 Thread Tristan Van Berkom
Dmitry A. Yanko wrote: Hi! I develop the app, that needs to run 2 same windows, each in separate thread. I have a same signal handlers in each thread. The difference is only in thread specific data, because i need to make a different things in different threads. Example: ... g_signal_connect(G_O

signals and threads

2005-12-05 Thread Dmitry A. Yanko
Hi! I develop the app, that needs to run 2 same windows, each in separate thread. I have a same signal handlers in each thread. The difference is only in thread specific data, because i need to make a different things in different threads. Example: ... g_signal_connect(G_OBJECT(app->text_buffer_my