How to notify one thread to terminate
-
Hello all, I want to notify thread1 to end by itself. I don't like to use the function TerminateThread() to do this job. But thread1 is a worker thread not a UI thread so it doesn't have a message queue. I can't send some messages to it. How can I do? Thanks a lot
-
Hello all, I want to notify thread1 to end by itself. I don't like to use the function TerminateThread() to do this job. But thread1 is a worker thread not a UI thread so it doesn't have a message queue. I can't send some messages to it. How can I do? Thanks a lot
Well, if the worker thread waits for an event with WaitForSingleObject then add one more event for quit event and then set that event by using SetEvent. The thread should wait for signal from one of the both events by using WaitForMultipleObjects API.
-
Well, if the worker thread waits for an event with WaitForSingleObject then add one more event for quit event and then set that event by using SetEvent. The thread should wait for signal from one of the both events by using WaitForMultipleObjects API.