namespace simgrid {
namespace simix {
-Mutex::Mutex() : mutex_(this)
+MutexImpl::MutexImpl() : mutex_(this)
{
XBT_IN("(%p)", this);
// Useful to initialize sleeping swag:
XBT_OUT();
}
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
{
XBT_IN("(%p)", this);
xbt_swag_free(this->sleeping);
XBT_OUT();
}
-void Mutex::lock(smx_actor_t issuer)
+void MutexImpl::lock(smx_actor_t issuer)
{
XBT_IN("(%p; %p)", this, issuer);
/* FIXME: check where to validate the arguments */
* \param issuer the process that tries to acquire the mutex
* \return whether we managed to lock the mutex
*/
-bool Mutex::try_lock(smx_actor_t issuer)
+bool MutexImpl::try_lock(smx_actor_t issuer)
{
XBT_IN("(%p, %p)", this, issuer);
if (this->locked) {
* If the unlocker is not the owner of the mutex nothing happens.
* If there are no process waiting, it sets the mutex as free.
*/
-void Mutex::unlock(smx_actor_t issuer)
+void MutexImpl::unlock(smx_actor_t issuer)
{
XBT_IN("(%p, %p)", this, issuer);
- if(!this->locked)
+ if (not this->locked)
THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
/* If the mutex is not owned by the issuer, that's not good */
smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall)
{
- return new simgrid::simix::Mutex();
+ return new simgrid::simix::MutexImpl();
}
// Simcall handlers:
{
auto previous = (cond->refcount_)++;
xbt_assert(previous != 0);
- (void) previous;
}
void intrusive_ptr_release(s_smx_cond_t *cond)
}
/******************************** Semaphores **********************************/
-#define SMX_SEM_NOLIMIT 99999
/** @brief Initialize a semaphore */
smx_sem_t SIMIX_sem_init(unsigned int value)
{
delete proc->waiting_synchro;
proc->waiting_synchro = nullptr;
SIMIX_simcall_answer(&proc->simcall);
- } else if (sem->value < SMX_SEM_NOLIMIT) {
+ } else {
sem->value++;
}
XBT_OUT();