- DEBUG1("Yield process '%s'", simix_global->current_process->name);
- xbt_assert0((simix_global->current_process != simix_global->maestro_process),
- "You are not supposed to run this function here!");
+#ifdef HAVE_MC
+ if(_surf_do_model_check){
+ req->process_sleep.result = SIMIX_DONE;
+ SIMIX_request_answer(req);
+ }
+#endif
+ smx_action_t action = SIMIX_process_sleep(req->issuer, req->process_sleep.duration);
+ xbt_fifo_push(action->request_list, req);
+ req->issuer->waiting_action = action;
+}
+
+smx_action_t SIMIX_process_sleep(smx_process_t process, double duration)
+{
+ smx_action_t action;
+ smx_host_t host = process->smx_host;
+
+ /* check if the host is active */
+ if (surf_workstation_model->extension.
+ workstation.get_state(host->host) != SURF_RESOURCE_ON) {
+ THROW1(host_error, 0, "Host %s failed, you cannot call this function",
+ host->name);
+ }
+
+ action = xbt_new0(s_smx_action_t, 1);
+ action->type = SIMIX_ACTION_SLEEP;
+ action->request_list = xbt_fifo_new();
+ action->name = xbt_strdup("sleep");
+#ifdef HAVE_TRACING
+ action->category = NULL;
+#endif
+
+ action->sleep.host = host;
+ action->sleep.surf_sleep =
+ surf_workstation_model->extension.workstation.sleep(host->host, duration);