November 19th, 2003, 04:11 AM
How to end threads good
I already solved the problem, but I hope that you have a better solution:
My app uses at least one worker thread. When started, it handles the communication via the rs232-comport.
When the user wants to close the whole app., I first tell the worker-thread to close. The last thing it does before leaving is to set a flag. My main program in the meantime just polls in a loop whether that flag is set. When found, it closes also.
So the worker thread sets the flag that it is closed already! I don't like my software to talk about future states of itself...
The code is working, but I think it is ineffective.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.