Smart Pointer: C++ Example of Using lock()