Re: multithreading gtk app



On 30 June 2010 01:57, Mick <bareman tpg com au> wrote:
can anyone point me to an explanation (with examples) to help me
understand running some dialogs in separate threads. (eg. help,
preferences, etc)

It's almost always best to only have a single GUI thread in a gtk
application, in my experience.

Use non-modal dialogs if you want your app to continue to function
while a dialog is being displayed.

If you have a long task which shouldn't block the GUI, put it in a
background thread and use g_idle_add() to have it signal the main
thread when it's done. I posted some example code to do this a little
while ago:

http://old.nabble.com/g_main_loop-and-g_async_queue-td21288177.html

(scroll down a bit)

John



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