Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill some remains of the pre-C++ era
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 24 Feb 2022 22:19:37 +0000 (23:19 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 24 Feb 2022 22:19:41 +0000 (23:19 +0100)
Back then, humans were supposed to manage the refcount manually.

src/kernel/activity/MutexImpl.cpp
src/kernel/activity/MutexImpl.hpp
src/kernel/activity/SemaphoreImpl.cpp
src/kernel/activity/SemaphoreImpl.hpp
src/s4u/s4u_Mutex.cpp
src/s4u/s4u_Semaphore.cpp

index f1e089f..bfce33a 100644 (file)
@@ -115,18 +115,6 @@ void MutexImpl::unlock(actor::ActorImpl* issuer)
   }
   XBT_OUT();
 }
-/** Increase the refcount for this mutex */
-MutexImpl* MutexImpl::ref()
-{
-  intrusive_ptr_add_ref(this);
-  return this;
-}
-
-/** Decrease the refcount for this mutex */
-void MutexImpl::unref()
-{
-  intrusive_ptr_release(this);
-}
 
 } // namespace activity
 } // namespace kernel
index 5ab4b5d..347880d 100644 (file)
@@ -83,9 +83,6 @@ public:
   void unlock(actor::ActorImpl* issuer);
   unsigned get_id() const { return id_; }
 
-  MutexImpl* ref();
-  void unref();
-
   actor::ActorImpl* get_owner() const { return owner_; }
 
   // boost::intrusive_ptr<Mutex> support:
index 85c1edf..021ef85 100644 (file)
@@ -48,19 +48,6 @@ void SemaphoreImpl::release()
   }
 }
 
-/** Increase the refcount for this semaphore */
-SemaphoreImpl* SemaphoreImpl::ref()
-{
-  intrusive_ptr_add_ref(this);
-  return this;
-}
-
-/** Decrease the refcount for this mutex */
-void SemaphoreImpl::unref()
-{
-  intrusive_ptr_release(this);
-}
-
 } // namespace activity
 } // namespace kernel
 } // namespace simgrid
index 47a6f71..3704fc4 100644 (file)
@@ -36,9 +36,6 @@ public:
   unsigned int get_capacity() const { return value_; }
   bool is_used() const { return not sleeping_.empty(); }
 
-  SemaphoreImpl* ref();
-  void unref();
-
   friend void intrusive_ptr_add_ref(SemaphoreImpl* sem)
   {
     XBT_ATTRIB_UNUSED auto previous = sem->refcount_.fetch_add(1);
index e429dac..3fca4c4 100644 (file)
@@ -64,13 +64,11 @@ MutexPtr Mutex::create()
 /* refcounting of the intrusive_ptr is delegated to the implementation object */
 void intrusive_ptr_add_ref(const Mutex* mutex)
 {
-  xbt_assert(mutex);
-  mutex->pimpl_->ref();
+  intrusive_ptr_add_ref(mutex->pimpl_);
 }
 void intrusive_ptr_release(const Mutex* mutex)
 {
-  xbt_assert(mutex);
-  mutex->pimpl_->unref();
+  intrusive_ptr_release(mutex->pimpl_);
 }
 
 } // namespace s4u
index 78a6dcf..05a203c 100644 (file)
@@ -51,14 +51,12 @@ bool Semaphore::would_block() const
 /* refcounting of the intrusive_ptr is delegated to the implementation object */
 void intrusive_ptr_add_ref(const Semaphore* sem)
 {
-  xbt_assert(sem);
-  sem->pimpl_->ref();
+  intrusive_ptr_add_ref(sem->pimpl_);
 }
 
 void intrusive_ptr_release(const Semaphore* sem)
 {
-  xbt_assert(sem);
-  sem->pimpl_->unref();
+  intrusive_ptr_release(sem->pimpl_);
 }
 
 } // namespace s4u