}
XBT_OUT();
}
-
-void SIMIX_synchro_finish(smx_activity_t synchro)
-{
- XBT_IN("(%p)", synchro.get());
- smx_simcall_t simcall = synchro->simcalls_.front();
- synchro->simcalls_.pop_front();
-
- SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
- simcall->issuer->waiting_synchro = nullptr;
-
- if (synchro->state_ != SIMIX_SRC_TIMEOUT) {
- xbt_assert(synchro->state_ == SIMIX_FAILED);
- simcall->issuer->context_->iwannadie = true;
- } else {
- SIMIX_simcall_answer(simcall);
- }
- XBT_OUT();
-}
-
-/******************************** Semaphores **********************************/
-
-static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_actor_t issuer,
- smx_simcall_t simcall)
-{
- XBT_IN("(%p, %f, %p, %p)",sem,timeout,issuer,simcall);
- smx_activity_t synchro = nullptr;
-
- XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
- if (sem->value_ <= 0) {
- synchro = SIMIX_synchro_wait(issuer->host_, timeout);
- synchro->simcalls_.push_front(simcall);
- issuer->waiting_synchro = synchro;
- sem->sleeping_.push_back(*issuer);
- } else {
- sem->value_--;
- SIMIX_simcall_answer(simcall);
- }
- XBT_OUT();
-}
-
-/**
- * @brief Handles a sem acquire simcall without timeout.
- */
-void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem)
-{
- XBT_IN("(%p)",simcall);
- _SIMIX_sem_wait(sem, -1, simcall->issuer, simcall);
- XBT_OUT();
-}
-
-/**
- * @brief Handles a sem acquire simcall with timeout.
- */
-void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout)
-{
- XBT_IN("(%p)",simcall);
- simcall_sem_acquire_timeout__set__result(simcall, 0); // default result, will be set to 1 on timeout
- _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);
- XBT_OUT();
-}