Re: How to properly exit a thread?
- From: "Xiangfei Jia" <xjianz gmail com>
- To: "Paul Davis" <pjdavis engineering uiowa edu>
- Cc: gtkmm-list gnome org
- Subject: Re: How to properly exit a thread?
- Date: Sun, 14 May 2006 18:30:39 +1200
On 5/14/06, Paul Davis <pjdavis engineering uiowa edu> wrote:
Xiangfei,
Docs indicate doing something like this:
void
FrameNode::read_new_data()
{
bool done = false ;
while( !done )
{
[do something]
}
throw Glib::Thread::Exit() ;
}
Thanks for your reply!! I tried to put "throw
Glib::Thread::Exit()" at the end of my thread function. It's not
working. I've still got the error message when the program is exiting.
What you've probably got at issue is guranteeing that all of your
threads have exited before you attempt to close your program. My guess
is that you've got a thread waiting on a condtion variable when an
attempt to destroy the condition variable is made.
Yes, you are right. The thread is always running and
reading new data from a file and waiting for the new data to be
consumed and then read more new data.
I can't make the thread joinable, because the thread is always running
during program execution. What I want to do is to exit the thread just
before the program is going to exit. That's what I don't know how to
achieve.
Thanks again!
Fei
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]