When you have a method (or thread) that needs to clean up resources on exit, and you have to worry about that method being interrupted, there is a technique where those resources will clean up themselves. In a nutshell, you create a class for the resource, then use an instance of that class in your code. The cleanup code will be in the class’ Destructor so, if the method ends prematurely, the resource will clean itself up.
So there’s a little tip for those who hadn’t thought of it before, but here’s my question:
What the heck is the name of that technique? I simply can’t recall…