]> AND Public Git Repository - simgrid.git/blobdiff - examples/c/energy-exec-ptask/energy-exec-ptask.c
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill trailing whitespaces in XML files.
[simgrid.git] / examples / c / energy-exec-ptask / energy-exec-ptask.c
index a92b76790043c74e452dd9f9e950b3a6d64f36f4..2356cc612fd878f240b0e238654c8acd220d0bb0 100644 (file)
@@ -47,7 +47,8 @@ static void runner(int argc, char* argv[])
       communication_amounts[i * host_count + j] = 1e7; // 10 MB
 
   sg_exec_t exec = sg_actor_parallel_exec_init(host_count, hosts, computation_amounts, communication_amounts);
-  sg_exec_wait_for(exec, 1 /* timeout (in seconds)*/);
+  if (sg_exec_wait_for(exec, 1 /* timeout (in seconds)*/) == SG_ERROR_TIMEOUT)
+    sg_exec_cancel(exec);
   xbt_free(communication_amounts);
   xbt_free(computation_amounts);