Ok, I cannot kill the thread. What about thread exceptions. How should they be implemented. I have an option to replace c++ exceptions with a call to static function if needed. Are the exceptions allowed and where should I catch them (in the example I gave at the top post)? It's not trivial to get rid of the exceptions in the thread (to exit cleanly).
But exceptions are GOOD in this context. They would perform the necessarry cleanup of resources. Simply catch the "thread canceled" exception in the main thread routine...
In fact, the only hard part is to how to throw them. There I see no other option than to call some function periodically, check for the exception flag and throw if set.
Well, anyway, I guess any serious GUI program should show the progress of processing anyway - maybe that is the right place to check for cancelation too....