I am refactoring my Windows Service so that access to the named Mutex
is centralized in the worker thread's method. Instead of releasing it in OnStop()
and ~DerivedService()
it now should be released in the finally block.
I've observed skipping of destructor calls when I hit Shift+F5 to stop debugging and expect that and a crash (more serious than politely raising an exception) would be the only reasons to skip the finally block.
As I am coding a Service and its worker thread I was hoping to clear up any nasty surprises here before the rigmorale of replacing service code, logging in and out, attaching debugger etc.
Thanks.