X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/47801f582a7b05f4cd4680f96fb44316fe4e7a89..c594594f3bf33a81f7641cfb20b915ded71431de:/src/xbt/xbt_sg_time.c?ds=sidebyside diff --git a/src/xbt/xbt_sg_time.c b/src/xbt/xbt_sg_time.c index b933c1f320..84ba8dfed7 100644 --- a/src/xbt/xbt_sg_time.c +++ b/src/xbt/xbt_sg_time.c @@ -9,7 +9,7 @@ #include "gras/Virtu/virtu_sg.h" -/* +/* * Time elapsed since the begining of the simulation. */ double xbt_time() { @@ -20,26 +20,25 @@ double xbt_time() { * Freeze the process for the specified amount of time */ void xbt_sleep(double sec) { - smx_action_t act_sleep; - smx_process_t proc = SIMIX_process_self(); - smx_mutex_t mutex; - smx_cond_t cond; - /* create action to sleep */ - act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc),sec); - - mutex = SIMIX_mutex_init(); - SIMIX_mutex_lock(mutex); - /* create conditional and register action to it */ - cond = SIMIX_cond_init(); - - SIMIX_register_condition_to_action(act_sleep, cond); - SIMIX_register_action_to_condition(act_sleep, cond); - SIMIX_cond_wait(cond,mutex); - SIMIX_mutex_unlock(mutex); - - /* remove variables */ - SIMIX_cond_destroy(cond); - SIMIX_mutex_destroy(mutex); - SIMIX_action_destroy(act_sleep); + smx_action_t act_sleep; + smx_process_t proc = SIMIX_process_self(); + smx_mutex_t mutex; + smx_cond_t cond; + /* create action to sleep */ + act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc),sec); + + mutex = SIMIX_mutex_init(); + SIMIX_mutex_lock(mutex); + /* create conditional and register action to it */ + cond = SIMIX_cond_init(); + + SIMIX_register_action_to_condition(act_sleep, cond); + SIMIX_cond_wait(cond,mutex); + SIMIX_mutex_unlock(mutex); + + /* remove variables */ + SIMIX_cond_destroy(cond); + SIMIX_mutex_destroy(mutex); + SIMIX_action_destroy(act_sleep); }