Ejemplo n.º 1
0
/**
 * \brief Cleans the MSG data of a process.
 * \param smx_proc a SIMIX process
 */
void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
{
  simdata_process_t msg_proc;

  // get the MSG process from the SIMIX process
  if (smx_proc == SIMIX_process_self()) {
    /* avoid a SIMIX request if this function is called by the process itself */
    msg_proc = SIMIX_process_self_get_data(smx_proc);
    SIMIX_process_self_set_data(smx_proc, NULL);
  }
  else {
    msg_proc = simcall_process_get_data(smx_proc);
    simcall_process_set_data(smx_proc, NULL);
  }

#ifdef HAVE_TRACING
  TRACE_msg_process_end(smx_proc);
#endif
  // free the data if a function was provided
  if (msg_proc->data && msg_global->process_data_cleanup) {
    msg_global->process_data_cleanup(msg_proc->data);
  }

  // remove the process from its virtual machine
  if (msg_proc->vm) {
    int pos = xbt_dynar_search(msg_proc->vm->processes,&smx_proc);
    xbt_dynar_remove_at(msg_proc->vm->processes,pos, NULL);
  }

  // free the MSG process
  xbt_free(msg_proc);
}
Ejemplo n.º 2
0
/**
 * \brief Cleans the MSG data of a process.
 * \param smx_proc a SIMIX process
 */
void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
{
  simdata_process_t msg_proc;

  // get the MSG process from the SIMIX process
  if (smx_proc == SIMIX_process_self()) {
    /* avoid a SIMIX request if this function is called by the process itself */
    msg_proc = SIMIX_process_self_get_data(smx_proc);
    SIMIX_process_self_set_data(smx_proc, NULL);
  }
  else {
    msg_proc = simcall_process_get_data(smx_proc);
    simcall_process_set_data(smx_proc, NULL);
  }

  TRACE_msg_process_end(smx_proc);
  // free the data if a function was provided
  if (msg_proc && msg_proc->data && msg_global->process_data_cleanup) {
    msg_global->process_data_cleanup(msg_proc->data);
  }

  // free the MSG process
  xbt_free(msg_proc);
  SIMIX_process_cleanup(smx_proc);
}
Ejemplo n.º 3
0
/******************************** Process ************************************/
void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
{
  simdata_process_t msg_proc;

  if (smx_proc == SIMIX_process_self()) {
    /* avoid a SIMIX request if this function is called by the process itself */
    msg_proc = SIMIX_process_self_get_data();
  }
  else {
    msg_proc = SIMIX_req_process_get_data(smx_proc);
  }

#ifdef HAVE_TRACING
  TRACE_msg_process_end(smx_proc);
#endif

  xbt_free(msg_proc);
}