1 /* time - time related syscal wrappers */
3 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "gras/Virtu/virtu_sg.h"
12 * Time elapsed since the begining of the simulation.
16 return SIMIX_get_clock();
20 * Freeze the process for the specified amount of time
22 void xbt_sleep(double sec)
24 smx_action_t act_sleep;
25 smx_process_t proc = SIMIX_process_self();
28 /* create action to sleep */
29 act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc), sec);
31 mutex = SIMIX_mutex_init();
32 SIMIX_mutex_lock(mutex);
33 /* create conditional and register action to it */
34 cond = SIMIX_cond_init();
36 SIMIX_register_action_to_condition(act_sleep, cond);
37 SIMIX_cond_wait(cond, mutex);
38 SIMIX_mutex_unlock(mutex);
40 /* remove variables */
41 SIMIX_cond_destroy(cond);
42 SIMIX_mutex_destroy(mutex);
43 SIMIX_action_destroy(act_sleep);