X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2a5be1efbd30fcf80a06645c196fcec50b19e665:/examples/msg/masterslave/masterslave_kill.c..5efe03db9d3a38dc14af6bd0711a5536605c8cd6:/examples/msg/process-kill/process-kill.c diff --git a/examples/msg/masterslave/masterslave_kill.c b/examples/msg/process-kill/process-kill.c similarity index 59% rename from examples/msg/masterslave/masterslave_kill.c rename to examples/msg/process-kill/process-kill.c index 365ebb3427..d33e3724c0 100644 --- a/examples/msg/masterslave/masterslave_kill.c +++ b/examples/msg/process-kill/process-kill.c @@ -8,31 +8,30 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -/** Lazy guy function. This process suspends itself asap. */ -static int slave(int argc, char *argv[]) +static int victim(int argc, char *argv[]) { XBT_INFO("Hello!"); XBT_INFO("Suspending myself"); MSG_process_suspend(MSG_process_self()); XBT_INFO("OK, OK. Let's work"); - MSG_task_execute(MSG_task_create("toto", 1e9, 0, NULL)); + MSG_task_execute(MSG_task_create("work", 1e9, 0, NULL)); XBT_INFO("Bye!"); return 0; } -static int master(int argc, char *argv[]) +static int killer(int argc, char *argv[]) { - msg_process_t bob = NULL; + msg_process_t poor_victim = NULL; XBT_INFO("Hello!"); - bob = MSG_process_create("slave", slave, NULL, MSG_host_by_name("Fafard")); + poor_victim = MSG_process_create("victim", victim, NULL, MSG_host_by_name("Fafard")); MSG_process_sleep(10.0); XBT_INFO("Resume process"); - MSG_process_resume(bob); + MSG_process_resume(poor_victim); XBT_INFO("Kill process"); - MSG_process_kill(bob); + MSG_process_kill(poor_victim); XBT_INFO("OK, goodbye now."); return 0; @@ -43,14 +42,13 @@ int main(int argc, char *argv[]) msg_error_t res = MSG_OK; MSG_init(&argc, argv); - xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" - "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", argv[0], argv[0]); + xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); MSG_create_environment(argv[1]); - MSG_function_register("master", master); - MSG_function_register("slave", slave); - MSG_launch_application(argv[2]); + MSG_function_register("killer", killer); + MSG_function_register("victim", victim); + MSG_process_create("killer", killer, NULL, MSG_host_by_name("Tremblay")); res = MSG_main();