Exemple #1
0
/**
 * \ingroup simix_process_management
 * \brief Set the kill time of a process.
 */
void simcall_process_set_kill_time(smx_process_t process, double kill_time)
{

  if (kill_time > SIMIX_get_clock()) {
    if (simix_global->kill_process_function) {
      XBT_DEBUG("Set kill time %f for process %s(%s)",kill_time, process->name,
          sg_host_get_name(process->host));
      process->kill_timer = SIMIX_timer_set(kill_time, kill_process_from_timer, process);
    }
  }
}
Exemple #2
0
/**
 * \ingroup simix_process_management
 * \brief Set the kill time of a process.
 */
void simcall_process_set_kill_time(smx_actor_t process, double kill_time)
{

  if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
    return;
  XBT_DEBUG("Set kill time %f for process %s(%s)",
    kill_time, process->name.c_str(), sg_host_get_name(process->host));
  process->kill_timer = SIMIX_timer_set(kill_time, [=] {
    simix_global->kill_process_function(process);
    process->kill_timer=nullptr;
  });
}
Exemple #3
0
void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t synchros, double timeout)
{
  smx_activity_t synchro;
  unsigned int cursor = 0;

  if (MC_is_active() || MC_record_replay_is_active()){
    if (timeout > 0.0)
      xbt_die("Timeout not implemented for waitany in the model-checker"); 
    int idx = SIMCALL_GET_MC_VALUE(simcall);
    synchro = xbt_dynar_get_as(synchros, idx, smx_activity_t);
    synchro->simcalls.push_back(simcall);
    simcall_comm_waitany__set__result(simcall, idx);
    synchro->state = SIMIX_DONE;
    SIMIX_comm_finish(synchro);
    return;
  }
  
  if (timeout < 0.0){
    simcall->timer = NULL;
  } else {
    simcall->timer = SIMIX_timer_set(SIMIX_get_clock() + timeout, [simcall]() {
      SIMIX_waitany_remove_simcall_from_actions(simcall);
      simcall_comm_waitany__set__result(simcall, -1);
      SIMIX_simcall_answer(simcall);
    });
  }
  
  xbt_dynar_foreach(synchros, cursor, synchro){
    /* associate this simcall to the the synchro */
    synchro->simcalls.push_back(simcall);

    /* see if the synchro is already finished */
    if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING){
      SIMIX_comm_finish(synchro);
      break;
    }
  }