Thread freezes gui after return



             Hi,
   I'm new to gtkmm, and I'm trying to write a multithreaded application.
I've read gtkmm docs and this list and as a result I created this code :

/***   cvthreadprocessor.cpp  ****/
//Class that loads gui from glade file, connects widgets and sets callbacks
...
void CvThreadProcessor::thread_dilate() {
       time_t cur_time = clock();
       while( (clock()-cur_time)/CLOCKS_PER_SEC < 2 )
                ;
       repaint(); //function which indicates that something has been done
       return;
} 
...
void CvThreadProcessor::button_dilate_clicked()
{
        Glib::Thread * thread = Glib::Thread::create(
sigc::mem_fun(*this,&CvThreadProcessor::thread_dilate), true);
}
/****            *****/

If I click on an dilate button gui doesn't freeze while executing
thread_dilate thread, but I can't press any more buttons after the method
has finished. Complete source code is available 
http://btekielski.googlepages.com/cv_threads.tar here 
If it isn't descriptive enough let me know what should I write more.
By the way if I turn -Wall g++ switch it gives me error :

"cvthreadprocessor.cpp: In member function `void
CvThreadProcessor::button_dilate_clicked()':
cvthreadprocessor.cpp:105: warning: unused variable 'thread' "

so I guess that there is something wrong with the way I create threads, but
I can't figure out what's exactly wrong.

I'd be glad for any help,
                   Best regards,
                            Bolek.
-- 
View this message in context: http://www.nabble.com/Thread-freezes-gui-after-return-tf2151998.html#a5943087
Sent from the Gtkmm forum at Nabble.com.




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