Re: How to rollback another stack in C++?
The prevaling solution is to kill the thread, which has two problems:
1) it leaves the object in a limbo state;
2) it does not reclaim the stack.
The solution to this problem is to leave the stack alone [:)] and use
WaitForMultipleObjects, or its equivalent on your OS.
Each thread should enter an infinite "while (true)" loop, blocked while
waiting on one of two things:
1. something to do
2. an indication that it should do no more (an indication that it
When 2 happens, it would break its infinite loop (normally blocked on
waiting for 1 or 2).
Once it breaks the infinite loop, the regularity of the C++
scoping/constructor/destructor model will make everything right.
If you discover a situation where everything is not right, even after
the thread dies, then it would have been wrong anyway.
As far as the infinite loop problem goes, there is a solution: tell
whoever is writing infinite loop code to stop doing that. :)
-Le Chaud Lapin-
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]