Gtk+ problem with time-consuming threads



Hi,

I'm trying to add GUI for my application and I choose to do it with Gtk+.
I've asked on this forum before about multithreading, but I still can't get
it right. I found few examples on how to use gthread on the web, but none of
them answers my question. 

My problem is:

(FYI: I programs using C language and compile it with gcc compiler on
MinGW.)

I provide the user with the OK button, when user click on that button, the
program will create some number of threads (more than 10) and each threads
will do time-consuming work in the background. I successfully compiled my
program, but when I click on OK button, the main window freeze (display "not
responding" message on Windows machine). 

One person on this forum suggested to me (thank you very much) that I should
make the threads unjoinable because the main thread have to wait for all
threads to finish their execution that's why the main window freeze. So I
eliminate all g_thread_join() but the problem still occur. 

Could someone please give me little sample code that provide only one
button. When that button is clicked some number of threads will do something
time-consuming in the background (something simple like multiplying numbers
1000 times in the for loop, just to give me an idea). 

Thank you very much. Any help would be highly appreciated, 
Pat 

PS. Sorry for my bad English. It's not my first langauge.

-- 
View this message in context: http://www.nabble.com/Gtk%2B-problem-with-time-consuming-threads-tp23398764p23398764.html
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.



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