Re: GUI freezes waiting for callback function to return



On 12/15/2012 11:08 AM, Mateusz Marzantowicz wrote:
Very valuable articles and blog posts.

Now I know that threading in GUI apps (using GTK+) is much harder then I
originally thought it is. Although my use case is very simple I must
employ complicated threading machinery. I'm playing with
consumer/producer pattern and separate worker thread and I hope it
doesn't blow up in my face. I've also found application that works
similarly to my own - baobab (disk usage analyzer).

You should be fine so long as nothing in your thread calls the GUI calls
directly.  Using a queue and the pattern you described is pretty
standard procedure for multi-threaded, or multi-process programming in
general.  And as the other poster said, use asynchronous I/O whenever
possible so you don't always need threads.

You say you have enjoyed complicated threading machinery before.  MFC
certainly never supported GUI calls from threads.  I remember having to
do queues and all kinds of other things to get get my threads to play
nice on Win32.



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