 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Steven Matrthews Guest
|
Posted: Sat Jul 26, 2003 5:03 pm Post subject: Using Threads |
|
|
Hello All,
I am learning how to use the TThread class to create
another thread from my mainform. Essentially, I am writing
a file/folder search program that uses a recursive function
called vSearch_Folder( ....) which takes 4 parameters. I am calling
this function within the Execute method of the thread object, using
the code below:-
void __fastcall searchThread::Execute()
{
FreeOnTerminate = false;
// call search functions
mainform->vSearch_Folder(THREAD_FolderPath,
THREAD_SearchString,
THREAD_iSwitch,
pTHREAD_iCounter);
// free up memory for thread object
FreeOnTerminate = true;
}
I am using a flag, FreeOnTerminate, to determine when the thread
has finished execution. (ie when the recursive function has finished.)
THe value of this flag is determined in mainform by calling inline
bool bGetThreadStatus(void){return FreeOnTerminate;};
which is declared in the class derived from TThread.
Q. Is there a better way to determine when a thread finishes execution ?
Thanks,
bigSteve
|
|
| 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
|
|