this goes out of scope at the end of the try block, so it doesn't hold the lock the whole time. you could use a scoped_ptr declared earlier that you reset here, but it might be simpler to make taking the lock separate from the constructor to avoid exceptions entirely. The destructor could assert that lock() is called so you make sure it stays close to RAII.