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)
27 host = SIMIX_host_self();
28 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(action, cond);
34 SIMIX_cond_wait(cond, mutex);
35 SIMIX_unregister_action_to_condition(action, cond);
36 SIMIX_mutex_unlock(mutex);
38 SIMIX_mutex_destroy(mutex);
39 SIMIX_cond_destroy(cond);
40 SIMIX_action_destroy(action);
42 // FIXME: check for success/failure?
48 void smpi_exit(int status)
51 SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
52 smpi_global->running_hosts_count--;
53 SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
54 SIMIX_process_kill(SIMIX_process_self());