The purpose of the member function std::unique_lock::release
is to be able to transfer the ownership of the lock to some other place. It is similar to the member function std::unique_ptr::release
, which transfers the ownership of the pointer (i.e. the responsibility to free the memory) to some other code.
That means: No, there is no need to release a std::unique_lock
after it has been unlocked.
By the way: If you only have to protect concurrent accesses to a std::shared_ptr
, then you should take a look at the atomic operations for std::shared_ptr
:
These operations are already supported by Clang 3.5, although the implementation is not lock free. GCC 4.8 doesn't support these operations at all.