Example #1
0
static void SIMIX_synchro_finish(smx_action_t action)
{
  XBT_IN("(%p)",action);
  smx_simcall_t simcall = xbt_fifo_shift(action->simcalls);

  switch (action->state) {

    case SIMIX_SRC_TIMEOUT:
      SMX_EXCEPTION(simcall->issuer, timeout_error, 0, "Synchro's wait timeout");
      break;

    case SIMIX_FAILED:
        simcall->issuer->context->iwannadie = 1;
//      SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
      break;

    default:
      THROW_IMPOSSIBLE;
      break;
  }

  SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
  simcall->issuer->waiting_action = NULL;
  SIMIX_synchro_destroy(action);
  SIMIX_simcall_answer(simcall);
  XBT_OUT();
}
Example #2
0
void worker(){
  worker_t p_me = MSG_host_get_data(MSG_host_self());

  while(1){
    m_task_t p_task = MSG_TASK_UNINITIALIZED;
    
    
    msg_comm_t comm =	MSG_task_irecv (&p_task, p_me->channel);
    MSG_comm_wait(comm, -1);
    MSG_comm_destroy(comm);
    
    task_t p_todo_task = MSG_task_get_data(p_task);
    if(p_todo_task!=FINALIZE){
    
      
      MSG_task_destroy(p_task);
      double delay = 1.0 + p_me->lf_delay*(double)rand()/(double)(RAND_MAX);
      if(delay<0){
        delay=0;
      }
      
      if (p_me->ps_ms_args->uc_coarse) {
        p_task = MSG_task_create(p_todo_task->name, delay*p_todo_task->f_unit_cost*MSG_get_host_speed(MSG_host_self()), 0, NULL);
      }
      else{
        //p_task = MSG_task_create(p_todo_task->name, delay*p_todo_task->f_unit_cost*pow(p_todo_task->ui_tile_size,3)/3.0, 0, NULL);
        p_task = MSG_task_create(p_todo_task->name, delay*p_todo_task->f_unit_cost*MSG_get_host_speed(MSG_host_self()), 0, NULL);
      }
      MSG_task_execute(p_task);

      xbt_fifo_shift(p_me->a_workqueue);
      p_me->p_last_task = p_todo_task;
      
    p_todo_task->uc_done = 1; 
    
      
    if(p_todo_task->e_type == Z || p_todo_task->e_type == ZS ){
        /*put the topmost line again in the triangles*/
        xbt_dynar_push_as(p_me->ps_ms_args->a_NT[p_todo_task->task.Z.ui_j],unsigned int,p_todo_task->task.Z.ui_ii);
    }
    else if (p_todo_task->e_type == F) {