Hi, i have a problem. I have 2 threads in my app, the main process
app and a background worker. In the background thread i have a top level
try catch block. I need to know best way to clean up handles to the
background
thread if it causes an exception.
try{
while (g_fContinue){
WaitForSingleObject(hEvent, TIMEOUT);
//some code
}
return 0;
}
catch(Exception& e){
e.ErrorMsg();
return 0;
}
To exit the thread from the main thread i just set the g_fContinue flag and
event
and then clean up but if it faults on its own where do i clean up. Can
i call CloseHandle(hThread) in the catch block?