Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a test in MSG_task_execute to stop whenever a task is being executed on two diffe...
[simgrid.git] / src / msg / gos.c
index 2bd20ed..a223cec 100644 (file)
@@ -75,11 +75,11 @@ static MSG_error_t __MSG_task_get_with_time_out_from_host(m_task_t * task,
     } else {
       __MSG_process_block(-1);
     }
+    h_simdata->sleeping[channel] = NULL;
+    first_time = 0;
     if(surf_workstation_resource->extension_public->get_state(h_simdata->host) 
        == SURF_CPU_OFF)
       MSG_RETURN(MSG_HOST_FAILURE);
-    h_simdata->sleeping[channel] = NULL;
-    first_time = 0;
     /* OK, we should both be ready now. Are you there ? */
   }
 
@@ -422,7 +422,8 @@ MSG_error_t MSG_task_put(m_task_t task,
   task_simdata = task->simdata;
   task_simdata->sender = process;
   task_simdata->source = MSG_process_get_host(process);
-  xbt_assert0(task_simdata->using==1,"Gargl!");
+  xbt_assert0(task_simdata->using==1,
+             "This taks is still being used somewhere else. You cannot send it now. Go fix your code!");
   task_simdata->comm = NULL;
   
   local_host = ((simdata_process_t) process->simdata)->host;
@@ -462,6 +463,7 @@ MSG_error_t MSG_task_put(m_task_t task,
     state=surf_workstation_resource->common_public->action_get_state(task_simdata->comm);
   }
   DEBUG0("Action terminated");
+  task->simdata->rate=-1.0; /* Sets the rate back to default */
 
   PAJE_PROCESS_POP_STATE(process);  
 
@@ -497,7 +499,6 @@ MSG_error_t MSG_task_put_bounded(m_task_t task,
   MSG_error_t res = MSG_OK;
   task->simdata->rate=max_rate;
   res = MSG_task_put(task, dest, channel);
-  task->simdata->rate=-1.0;
   return(res);
 }
 
@@ -533,6 +534,7 @@ void __MSG_task_execute(m_process_t process, m_task_t task)
   CHECK_HOST();
 
   simdata = task->simdata;
+  xbt_assert0(!simdata->compute,"This taks is executed somewhere else. Go fix your code!");
 
   simdata->compute = surf_workstation_resource->extension_public->
     execute(MSG_process_get_host(process)->simdata->host,