Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not pass a pointer to dynar where a pointer to sem is expected...
[simgrid.git] / src / simix / smx_synchro.c
index bec90e9..8cc9729 100644 (file)
@@ -485,7 +485,6 @@ void SIMIX_sem_acquire_timeout(smx_sem_t sem, double max_duration)
     sem->capacity--;
     return;
   }
-  sem->capacity--;
 
   /* Always create an action null in case there is a host failure */
   act_sleep = SIMIX_action_sleep(SIMIX_host_self(), max_duration);
@@ -548,7 +547,7 @@ unsigned int SIMIX_sem_acquire_any(xbt_dynar_t sems)
                                      xbt_dynar_get_as(sems, 0, smx_sem_t));
 
   /* Get listed as member of all the provided semaphores */
-  self->sem = (smx_sem_t) sems; /* FIXME: we pass a pointer to dynar where a pointer to sem is expected... */
+  self->sem = xbt_dynar_getfirst_as(sems, smx_sem_t);
   xbt_dynar_foreach(sems, counter, sem) {
     xbt_fifo_push(sem->sleeping, self);
   }