Re: signals and threads



On 12/5/05, Dmitry A. Yanko <fm cross-road org ua> 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.

Unless i'm thoroughly confused, you're going about this in the wrong way.

Your UI can't run in separate threads, all the UI interaction has to
be done through the main UI thread.  The fact that you've created the
windows from different threads will be the source of all sorts of
problems since GUI functionality isn't designed to be thread safe.

It is mistaken to think of the windows as running in different threads
- your calculations / data retrieval / whatever is generating the
content for the windows can be run in different threads, but when you
actually want to display stuff to the UI, you need to do it in the
main thread.

You can use g_idle_add() to trigger your UI updates from your data
processing threads.

-Daniel


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