Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make msg_process_t point onto s4u::Actor*
[simgrid.git] / teshsuite / msg / pid / pid.c
index 081d8c0..ebe6b3a 100644 (file)
@@ -31,10 +31,9 @@ static int sendpid(int argc, char *argv[])
 
 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);
@@ -44,20 +43,19 @@ static int killall(int argc, char *argv[]){
   return 0;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
-  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;
 }