 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Emmanuel Guest
|
Posted: Sun Feb 15, 2004 9:25 pm Post subject: About TThread::Terminate() |
|
|
Dear All,
I want to know the whole process after calling TThread::Terminate()
My TThread is something about that
TMyThread::TMyThread(...)
{A=new *TStringList;
......
}
TMyThread::~TMyThread(...)
{delete A;
......
}
TMyThread*MyThread1;
Question 1: need I delete the object MyThread1 ,after I call
TThread::Terminate()?
Question 1: need ~TMyThread(...) delete everything created in the
TMyThread()
My problem is that, After call TThread::Terminate(), and delete the TThread
I find that when it process ~TMyThread(...) to delete A error occured
Thank
Emmanuel
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sun Feb 15, 2004 11:11 pm Post subject: Re: About TThread::Terminate() |
|
|
"Emmanuel" <emmanuel (AT) erphk (DOT) com> wrote
| Quote: | need I delete the object MyThread1 ,after I call TThread::Terminate()?
|
If you do not set the thread's FreeOnTerminate property to true, then yes.
You should call the thread's WaitFor() method after calling Terminate() to
make sure the thread is fully terminated before you delete it, ie:
MyThread1->Terminate();
MyThread1->WaitFor();
delete MyThread1;
| Quote: | need ~TMyThread(...) delete everything created in the TMyThread()
|
That depends on what your thread is doing to begin with and what all it is
actually allocating.
| Quote: | My problem is that, After call TThread::Terminate(), and delete the
TThread I find that when it process ~TMyThread(...) to delete A
error occured
|
You need to show a more completely code snippet. What kind of error is
occuring exactly? Please be more specific.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|