X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c8880fd8bfe302109bdec0629929499479d714b0..f70ee620c8df5cdf749f4dfbc9777359cd3cb12a:/src/simix/smx_synchro.c diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index efbb1d63fd..a9d9219b0b 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_synchro, simix, "SIMIX Synchronization (mutex, semaphores and conditions)"); -static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout); +static smx_synchro_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout); static void SIMIX_synchro_finish(smx_synchro_t synchro); static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, smx_process_t issuer, smx_simcall_t simcall); @@ -20,7 +20,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer, /***************************** Raw synchronization *********************************/ -static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout) +static smx_synchro_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout) { XBT_IN("(%p, %f)",smx_host,timeout); @@ -28,8 +28,7 @@ static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout) sync = xbt_mallocator_get(simix_global->synchro_mallocator); sync->type = SIMIX_SYNC_SYNCHRO; sync->name = xbt_strdup("synchro"); - sync->synchro.sleep = - surf_workstation_sleep(smx_host, timeout); + sync->synchro.sleep = surf_host_sleep(smx_host, timeout); surf_action_set_data(sync->synchro.sleep, sync); XBT_OUT(); @@ -155,7 +154,7 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) if (mutex->locked) { /* FIXME: check if the host is active ? */ /* Somebody using the mutex, use a synchronization to get host failures */ - synchro = SIMIX_synchro_wait(process->smx_host, -1); + synchro = SIMIX_synchro_wait(process->host, -1); xbt_fifo_push(synchro->simcalls, simcall); simcall->issuer->waiting_synchro = synchro; xbt_swag_insert(simcall->issuer, mutex->sleeping); @@ -170,7 +169,7 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex){ return SIMIX_mutex_trylock(mutex, simcall->issuer); -} +} /** * \brief Tries to lock a mutex. * @@ -231,9 +230,6 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer) XBT_OUT(); } -void simcall_HANDLER_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex){ - SIMIX_mutex_destroy(mutex); -} /** * \brief Destroys a mutex. * @@ -252,9 +248,6 @@ void SIMIX_mutex_destroy(smx_mutex_t mutex) /********************************* Condition **********************************/ -smx_cond_t simcall_HANDLER_cond_init(smx_simcall_t simcall){ - return SIMIX_cond_init(); -} /** * \brief Initialize a condition. * @@ -316,16 +309,13 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, SIMIX_mutex_unlock(mutex, issuer); } - synchro = SIMIX_synchro_wait(issuer->smx_host, timeout); + synchro = SIMIX_synchro_wait(issuer->host, timeout); xbt_fifo_unshift(synchro->simcalls, simcall); issuer->waiting_synchro = synchro; xbt_swag_insert(simcall->issuer, cond->sleeping); XBT_OUT(); } -void simcall_HANDLER_cond_signal(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_signal(cond); -} /** * \brief Signalizes a condition. * @@ -363,9 +353,6 @@ void SIMIX_cond_signal(smx_cond_t cond) XBT_OUT(); } -void simcall_HANDLER_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_broadcast(cond); -} /** * \brief Broadcasts a condition. * @@ -385,11 +372,8 @@ void SIMIX_cond_broadcast(smx_cond_t cond) XBT_OUT(); } -void simcall_HANDLER_cond_destroy(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_destroy(cond); -} /** - * \brief Destroys a contidion. + * \brief Destroys a condition. * * Destroys and frees the condition's memory. * \param cond A condition @@ -411,9 +395,6 @@ void SIMIX_cond_destroy(smx_cond_t cond) /******************************** Semaphores **********************************/ #define SMX_SEM_NOLIMIT 99999 -smx_sem_t simcall_HANDLER_sem_init(smx_simcall_t simcall, unsigned int value){ - return SIMIX_sem_init(value); -} /** @brief Initialize a semaphore */ smx_sem_t SIMIX_sem_init(unsigned int value) { @@ -427,9 +408,6 @@ smx_sem_t SIMIX_sem_init(unsigned int value) return sem; } -void simcall_HANDLER_sem_destroy(smx_simcall_t simcall, smx_sem_t sem){ - SIMIX_sem_destroy(sem); -} /** @brief Destroys a semaphore */ void SIMIX_sem_destroy(smx_sem_t sem) { @@ -495,7 +473,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer, XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout); if (sem->value <= 0) { - synchro = SIMIX_synchro_wait(issuer->smx_host, timeout); + synchro = SIMIX_synchro_wait(issuer->host, timeout); xbt_fifo_unshift(synchro->simcalls, simcall); issuer->waiting_synchro = synchro; xbt_swag_insert(issuer, sem->sleeping);