we should use RAII unlock instead of using unique_lock::unlock() at end of block