Back then, humans were supposed to manage the refcount manually.
}
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
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:
}
}
-/** 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
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);
/* 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
/* 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