X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/091fbe9c7883aeec04fdd7b10ec01c43b7402936..0ae0dc6c811f90a65c57d3b551424d326e2da264:/teshsuite/msg/process-kill/process-kill.c diff --git a/teshsuite/msg/process-kill/process-kill.c b/teshsuite/msg/process-kill/process-kill.c index 37ee439037..055c763e00 100644 --- a/teshsuite/msg/process-kill/process-kill.c +++ b/teshsuite/msg/process-kill/process-kill.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007, 2009-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2019. 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. */ @@ -7,7 +7,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_process_kill, "Messages specific for this msg example"); -static int victimA_fun(int argc, char* argv[]) +static int victim_fun(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) { XBT_INFO("Hello!"); XBT_INFO("Suspending myself"); @@ -18,27 +18,17 @@ static int victimA_fun(int argc, char* argv[]) return 0; } -static int victimB_fun(int argc, char* argv[]) -{ - XBT_INFO("Terminates before being killed"); - return 0; -} - -static int killer(int argc, char* argv[]) +static int killer(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) { XBT_INFO("Hello!"); /* - First start a victim process */ - msg_process_t victimA = MSG_process_create("victim A", victimA_fun, NULL, MSG_host_by_name("Fafard")); - msg_process_t victimB = MSG_process_create("victim B", victimB_fun, NULL, MSG_host_by_name("Bourassa")); + msg_process_t victim = MSG_process_create("victim", victim_fun, NULL, MSG_host_by_name("Fafard")); MSG_process_sleep(10.0); - XBT_INFO("Resume victimA"); /* - Resume it from its suspended state */ - MSG_process_resume(victimA); - - XBT_INFO("Kill victimA"); /* - and then kill it */ - MSG_process_kill(victimA); + XBT_INFO("Resume victim"); /* - Resume it from its suspended state */ + MSG_process_resume(victim); - XBT_INFO("Kill victimB, even if it's already dead"); /* that's a no-op, there is no zombies in SimGrid */ - MSG_process_kill(victimB); + XBT_INFO("Kill victim"); /* - and then kill it */ + MSG_process_kill(victim); XBT_INFO("OK, goodbye now. I commit a suicide."); MSG_process_kill(MSG_process_self());