X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5ac4d2b6e654a1bbe13782569e401a875cb9aab6..83f28c874af4faaeaaa19571afc2cd52c801da39:/src/simix/smx_synchro.cpp diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 25f766451b..0cd3b01a9d 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -59,63 +59,3 @@ void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall) } 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(); -}