From: Arnaud Giersch Date: Mon, 15 Mar 2021 22:04:41 +0000 (+0100) Subject: Make Semaphore::~Sepmaphore() private. X-Git-Tag: v3.27~118 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8d0ebfc17818c771b7f3a0850364d61795e5d1de Make Semaphore::~Sepmaphore() private. This is a followup to commit 993a22f9b7f34d3a536bfe6a49a31405461dea5d "Add SemaphoreImpl::piface_ (mimic MutexImpl)." --- diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index d7179fd26d..e7e55e26bd 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -131,6 +131,8 @@ namespace activity { using RawImplPtr = boost::intrusive_ptr; class SemaphoreImpl; using SemaphoreImplPtr = boost::intrusive_ptr; + XBT_PUBLIC void intrusive_ptr_add_ref(SemaphoreImpl* sem); + XBT_PUBLIC void intrusive_ptr_release(SemaphoreImpl* sem); class SleepImpl; using SleepImplPtr = boost::intrusive_ptr; diff --git a/include/simgrid/s4u/Semaphore.hpp b/include/simgrid/s4u/Semaphore.hpp index b100ba560d..159d0ac6f5 100644 --- a/include/simgrid/s4u/Semaphore.hpp +++ b/include/simgrid/s4u/Semaphore.hpp @@ -30,6 +30,7 @@ namespace s4u { */ class XBT_PUBLIC Semaphore { friend kernel::activity::SemaphoreImpl; + friend void kernel::activity::intrusive_ptr_release(kernel::activity::SemaphoreImpl* sem); kernel::activity::SemaphoreImpl* const pimpl_; @@ -37,6 +38,7 @@ class XBT_PUBLIC Semaphore { friend void intrusive_ptr_release(const Semaphore* sem); explicit Semaphore(kernel::activity::SemaphoreImpl* sem) : pimpl_(sem) {} + ~Semaphore() = default; #ifndef DOXYGEN Semaphore(Semaphore const&) = delete; // No copy constructor. Use SemaphorePtr instead Semaphore& operator=(Semaphore const&) = delete; // No direct assignment either. Use SemaphorePtr instead