X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/83f0364920918d0380a5d538216193bfe00ddc47..230f14e9e54194231417a6afe68983b67693ed6d:/examples/c/energy-exec-ptask/energy-exec-ptask.c diff --git a/examples/c/energy-exec-ptask/energy-exec-ptask.c b/examples/c/energy-exec-ptask/energy-exec-ptask.c index a92b767900..988f7fcc03 100644 --- a/examples/c/energy-exec-ptask/energy-exec-ptask.c +++ b/examples/c/energy-exec-ptask/energy-exec-ptask.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -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);