]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/async: fix duplicate definition errors from SharedMutexImpl
authorCasey Bodley <cbodley@redhat.com>
Sat, 17 Sep 2022 18:46:19 +0000 (14:46 -0400)
committerCasey Bodley <cbodley@redhat.com>
Sun, 21 Jul 2024 14:27:17 +0000 (10:27 -0400)
the linker complains that several SharedMutexImpl functions are
duplicated, if "common/async/shared_mutex.h" is included by more than
one translation unit

added 'inline' to the function definitions so they're shared instead of
duplicated

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/async/detail/shared_mutex.h

index 80a5c3bd7fd4ec337db65b3369ffd30d9b0c82ab..6eae25b430d860b0f1e3a9ab031db85e9f7e19fd 100644 (file)
@@ -156,7 +156,7 @@ inline void SharedMutexImpl::lock()
   }
 }
 
-void SharedMutexImpl::lock(boost::system::error_code& ec)
+inline void SharedMutexImpl::lock(boost::system::error_code& ec)
 {
   std::unique_lock lock{mutex};
 
@@ -181,7 +181,7 @@ inline bool SharedMutexImpl::try_lock()
   return false;
 }
 
-void SharedMutexImpl::unlock()
+inline void SharedMutexImpl::unlock()
 {
   RequestList granted;
   {
@@ -245,7 +245,7 @@ inline void SharedMutexImpl::lock_shared()
   }
 }
 
-void SharedMutexImpl::lock_shared(boost::system::error_code& ec)
+inline void SharedMutexImpl::lock_shared(boost::system::error_code& ec)
 {
   std::unique_lock lock{mutex};
 
@@ -303,8 +303,8 @@ inline void SharedMutexImpl::cancel()
   complete(std::move(canceled), boost::asio::error::operation_aborted);
 }
 
-void SharedMutexImpl::complete(RequestList&& requests,
-                               boost::system::error_code ec)
+inline void SharedMutexImpl::complete(RequestList&& requests,
+                                      boost::system::error_code ec)
 {
   while (!requests.empty()) {
     auto& request = requests.front();