From b83e84b4679165e949264a12d7a7a5f09fa5fa76 Mon Sep 17 00:00:00 2001 From: Vlad Zolotarov Date: Wed, 11 Mar 2020 17:43:13 -0400 Subject: [PATCH] db::hints:: optimize with_file_update_mutex() Avoid extra shared_ptr copy. Signed-off-by: Vlad Zolotarov Reviewed-by: Benny Halevy Message-Id: <20200311214313.2988-1-vladz@scylladb.com> --- db/hints/manager.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/hints/manager.hh b/db/hints/manager.hh index 47b1b626cc..7e1a3e8a5d 100644 --- a/db/hints/manager.hh +++ b/db/hints/manager.hh @@ -391,8 +391,7 @@ public: /// \return Whatever \ref func returns. template friend inline auto with_file_update_mutex(end_point_hints_manager& ep_man, Func&& func) { - lw_shared_ptr lock_ptr = ep_man._file_update_mutex_ptr; - return with_lock(*lock_ptr, std::forward(func)).finally([lock_ptr] {}); + return with_lock(*ep_man._file_update_mutex_ptr, std::forward(func)).finally([lock_ptr = ep_man._file_update_mutex_ptr] {}); } const fs::path& hints_dir() const noexcept {