Exemplo n.º 1
0
/**
 * \ingroup simix_comm_management
 */
void simcall_comm_send(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate,
                         void *src_buff, size_t src_buff_size,
                         int (*match_fun)(void *, void *, smx_synchro_t),
                         void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data,
                         double timeout)
{
  /* checking for infinite values */
  xbt_assert(std::isfinite(task_size), "task_size is not finite!");
  xbt_assert(std::isfinite(rate), "rate is not finite!");
  xbt_assert(std::isfinite(timeout), "timeout is not finite!");

  xbt_assert(mbox, "No rendez-vous point defined for send");

  if (MC_is_active() || MC_record_replay_is_active()) {
    /* the model-checker wants two separate simcalls */
    smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */
    comm = simcall_comm_isend(sender, mbox, task_size, rate,
        src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0);
    simcall_comm_wait(comm, timeout);
    comm = NULL;
  }
  else {
    simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size,
                         match_fun, copy_data_fun, data, timeout);
  }
}
Exemplo n.º 2
0
/**
 * \ingroup simix_comm_management
 */
void simcall_comm_send(smx_rdv_t rdv, double task_size, double rate,
                         void *src_buff, size_t src_buff_size,
                         int (*match_fun)(void *, void *, smx_action_t), void *data,
                         double timeout)
{
  /* checking for infinite values */
  xbt_assert(isfinite(task_size), "task_size is not finite!");
  xbt_assert(isfinite(rate), "rate is not finite!");
  xbt_assert(isfinite(timeout), "timeout is not finite!");
  
  xbt_assert(rdv, "No rendez-vous point defined for send");

  if (MC_is_active()) {
    /* the model-checker wants two separate simcalls */
    smx_action_t comm = simcall_comm_isend(rdv, task_size, rate,
        src_buff, src_buff_size, match_fun, NULL, data, 0);
    simcall_comm_wait(comm, timeout);
  }
  else {
    simcall_BODY_comm_send(rdv, task_size, rate, src_buff, src_buff_size,
                         match_fun, data, timeout);
  }
}