3 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
11 now = SIMIX_get_clock();
13 tv->tv_usec = ((now - (double)tv->tv_sec) * 1000000.0);
19 unsigned int smpi_sleep(unsigned int seconds)
24 smx_action_t sleep_action;
27 host = SIMIX_host_self();
28 sleep_action = SIMIX_action_sleep(host, seconds);
29 mutex = SIMIX_mutex_init();
30 cond = SIMIX_cond_init();
32 SIMIX_mutex_lock(mutex);
33 SIMIX_register_action_to_condition(sleep_action, cond);
34 SIMIX_cond_wait(cond, mutex);
35 SIMIX_unregister_action_to_condition(sleep_action, cond);
36 SIMIX_mutex_unlock(mutex);
38 SIMIX_mutex_destroy(mutex);
39 SIMIX_cond_destroy(cond);
41 // FIXME: check for success/failure?
47 void smpi_exit(int status)
50 SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
51 smpi_global->running_hosts_count--;
52 SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
53 SIMIX_process_kill(SIMIX_process_self());