Multithreading Multi-Threaded Programming
Multithreading Multi-Threaded Programming
Multithreading Multi-Threaded Programming
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Terminating a running thread<br />
} Normal Thread Termination<br />
} For a worker thread, normal thread termination is simple:<br />
Exit the controlling function and return a value that signifies<br />
the reason for termination.<br />
} not a good idea to call TerminateThread.<br />
} The target thread's initial stack is not freed, causing a resource<br />
leak.<br />
} Premature Thread Termination<br />
} Call AfxEndThread from within the thread. Pass the desired<br />
exit code as the only parameter.<br />
} AfxEndThread must be called from within the thread to be<br />
terminated.<br />
16<br />
Advanced Windows Network <strong>Programming</strong><br />
11/11/12