static int killall(int argc, char *argv[]){
msg_task_t task = NULL;
- XBT_ATTRIB_UNUSED int res;
for (int i=0; i<3;i++) {
- res = MSG_task_receive(&(task), mailbox);
+ MSG_task_receive(&(task), mailbox);
int pid = *(int*)MSG_task_get_data(task);
MSG_task_destroy(task);
XBT_INFO("Killing process \"%d\".", pid);
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
- msg_error_t res = MSG_OK;
-
MSG_init(&argc, argv);
- MSG_function_register("sendpid", &sendpid);
- MSG_function_register("killall", &killall);
+ xbt_assert(argc >= 2, "Usage: pid platform pid_to_kill");
- MSG_process_killall(atoi(argv[3]));
+ MSG_process_killall(atoi(argv[2]));
MSG_create_environment(argv[1]);
- MSG_launch_application(argv[2]);
- res = MSG_main();
+ MSG_process_create("sendpid", sendpid, NULL, MSG_get_host_by_name("Tremblay"));
+ MSG_process_create("sendpid", sendpid, NULL, MSG_get_host_by_name("Tremblay"));
+ MSG_process_create("sendpid", sendpid, NULL, MSG_get_host_by_name("Tremblay"));
+ MSG_process_create("killall", killall, NULL, MSG_get_host_by_name("Tremblay"));
- return res != MSG_OK;
+ return MSG_main() != MSG_OK;
}