How can I Stop a working thread from the main thread?
In the main thread I have the HANDLE of the working thread.
The user has activated WM_CLOSE in the main thread's window and I have to stop this worker thread.
This worker contains mainly a really long loop which contributes to more than approx:98% of the working thread function's time.
I checked the documentation and found two functions.
TerminateThread(). But ExitThread() is called implicitly BY the thread and the documentation says that the latter is very dangerous and should be used sparingly only.
I am thinking of a global variable(BOOL) to signal the worker thread.
Can somebody suggest a better way ?
Thanks in avance.