I use a VCL that searches for files in a given folder + subfolders, TmFileScan by Mats Asplund, http://hem.passagen.se/matasp
The searchroutine creates and runs in it's own thread.
There's an event when the search is finished.
In my program, I want to launch the search, wait until it's finished and then continue. All in same procedure.
do something here
FileScan.start; // Starts the searching
// program should wait here until the searching is done
continue to do something with the result.
I could use a global boolean and set it to true in the event for when the search are finished and use it in a repeat - until.
But if something goes wrong with the search and never get done, the program will wait forever. (I guess)
What is the smartest way to prevent this to happen?