Yeah, this is going to mix very badly with exceptions.
Also, a little rootling around on the web reveals the following statement in IBM's z/OS docs:
"Do not issue getcontext() in a C++ constructor or destructor, since the saved context would not be usable in a subsequent setcontext() or swapcontext() after the constructor or destructor returns."
Indeed. This was more of an experiment than anything else. Ideally, I should have a function that catches all exceptions before calling the user's function to make it safer.
Also, a little rootling around on the web reveals the following statement in IBM's z/OS docs:
"Do not issue getcontext() in a C++ constructor or destructor, since the saved context would not be usable in a subsequent setcontext() or swapcontext() after the constructor or destructor returns."