Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
check that suiciding a process actually works in C
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 26 Jan 2017 15:14:54 +0000 (16:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 26 Jan 2017 15:14:54 +0000 (16:14 +0100)
examples/msg/process-kill/process-kill.c
examples/msg/process-kill/process-kill.tesh

index 534e6d8..fe02ef8 100644 (file)
@@ -30,7 +30,10 @@ static int killer(int argc, char *argv[])
   XBT_INFO("Kill process");   /* - and then kill it */
   MSG_process_kill(poor_victim);
 
-  XBT_INFO("OK, goodbye now.");
+  XBT_INFO("OK, goodbye now. I commit a suicide.");
+  MSG_process_kill(MSG_process_self());
+
+  XBT_INFO("This line will never get displayed: I'm already dead since the previous line.");
   return 0;
 }
 
index 44e14d3..abe9ae6 100644 (file)
@@ -8,5 +8,5 @@ $ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/small_platform.xml "--lo
 > [  0.000000] (2:victim@Fafard) Suspending myself
 > [ 10.000000] (1:killer@Tremblay) Resume process
 > [ 10.000000] (1:killer@Tremblay) Kill process
-> [ 10.000000] (1:killer@Tremblay) OK, goodbye now.
+> [ 10.000000] (1:killer@Tremblay) OK, goodbye now. I commit a suicide.
 > [ 10.000000] (0:maestro@) Simulation time 10