Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill exception example
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 26 Apr 2016 09:22:55 +0000 (11:22 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 26 Apr 2016 09:22:55 +0000 (11:22 +0200)
examples/msg/CMakeLists.txt
examples/msg/exception/exception.c [deleted file]
examples/msg/exception/exception.tesh [deleted file]

index a4bdbc7..f56e9d1 100644 (file)
@@ -1,6 +1,6 @@
 foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring async-wait async-waitall 
           async-waitany cloud-capping cloud-masterworker cloud-migration cloud-multicore cloud-simple cloud-two-tasks
-          dht-chord dht-pastry exception energy-consumption energy-onoff energy-pstate energy-ptask energy-vm failures 
+          dht-chord dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm failures 
           io-file io-remote io-storage task-priority process-kill process-migration process-suspend 
           platform-properties set-maestro process-startkilltime synchro trace-categories 
           trace-link-srcdst-user-variables trace-link-user-variables trace-masterworker trace-platform 
@@ -113,6 +113,5 @@ if(HAVE_NS3)
   ADD_TESH_FACTORIES(msg-network-ns3 "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/network-ns3/network-ns3.tesh)
 endif()
 
-# These one are not usable:
-# ADD_TESH_FACTORIES(msg-exception "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/exception/exception.tesh)
+# This one is not usable:
 # ADD_TESH_FACTORIES(msg-dht-pastry                    "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/dht-pastry --cd ${CMAKE_BINARY_DIR}/examples/msg/dht-pastry dht-pastry.tesh)
diff --git a/examples/msg/exception/exception.c b/examples/msg/exception/exception.c
deleted file mode 100644 (file)
index e505e75..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (c) 2007, 2009-2015. 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. */
-
-#include "simgrid/msg.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test_exception, "Messages specific for this msg example");
-
-/** @addtogroup MSG_examples
- * 
- * - <b>exception/exception.c</b>: Demonstrates how to send an exception to a remote guy
- */
-
-/** Victim. This process gets a lot of remote exceptions  */
-static int victim(int argc, char *argv[]) {
-  xbt_ex_t e;
-  msg_error_t res = MSG_OK;
-  
-  XBT_INFO("Let's work.");
-  TRY {  
-    res = MSG_task_execute(MSG_task_create("Task", 1e14, 0, NULL));
-    if (res != MSG_OK) {
-      XBT_INFO("The MSG_task_execute caught the exception for me and returned %d)",res);
-    } else {
-      xbt_die("I was expecting an exception during my execution!");
-    }
-  } CATCH(e) {
-    XBT_INFO("The received exception resumed my execution. Good. Here is it:  ----------------------->8----");
-    xbt_ex_display(&e);
-    XBT_INFO("(end of the first exception) ----8<------------------------");
-    xbt_ex_free(e);
-  }
-
-  XBT_INFO("Let's get suspended.");
-  int gotit = 0;
-  TRY {
-    MSG_process_suspend(MSG_process_self());
-  } CATCH(e) {
-    XBT_INFO("The received exception resumed my suspension. Good. Here is it:  ----------------------->8----");
-    xbt_ex_display(&e);
-    XBT_INFO("(end of the second exception) ----8<------------------------");
-    gotit = 1;
-    xbt_ex_free(e);
-  }
-  if(!gotit) {
-    xbt_die("I was expecting an exception during my suspension!");
-  }
-
-  XBT_INFO("Let's sleep for 10 seconds.");
-  TRY {
-    res = MSG_process_sleep(10);
-    if (res != MSG_OK) {
-      XBT_INFO("The MSG_process_sleep caught the exception for me and returned %d)",res);
-    } else {
-      xbt_die("I was expecting to get an exception during my nap.");
-    }
-  } CATCH(e) {
-    XBT_INFO("Got the second exception:   ----------------------->8----");
-    xbt_ex_display(&e);
-    XBT_INFO("(end of the third exception) ----8<------------------------");
-    xbt_ex_free(e);
-  }
-
-  XBT_INFO("Let's try a last time to do something on something");
-  MSG_process_sleep(10);
-
-  XBT_INFO("That's enough now. I quit.");
-  return 0;
-}
-
-/** Terrorist. This process sends a bunch of exceptions to the victim. */
-static int terrorist(int argc, char *argv[])
-{
-  msg_process_t victim_process = NULL;
-
-  XBT_INFO("Let's create a victim.");
-  victim_process = MSG_process_create("victim", victim, NULL, MSG_host_self());
-
-  XBT_INFO("Going to sleep for 1 second");
-  if (MSG_process_sleep(1) != MSG_OK)
-     xbt_die("What's going on??? I failed to sleep!");
-  XBT_INFO("Send a first exception (host failure)");
-  SIMIX_process_throw(victim_process, host_error, 0, "First Trick: Let's pretend that the host failed");
-
-  XBT_INFO("Sweet, let's prepare a second trick!");
-  XBT_INFO("Going to sleep for 2 seconds");
-
-  if (MSG_process_sleep(2) != MSG_OK)
-     xbt_die("What's going on??? I failed to sleep!");
-  XBT_INFO("Send a second exception (host failure)");
-  SIMIX_process_throw(victim_process, host_error, 0, "Second Trick: Let's pretend again that the host failed");
-
-  XBT_INFO("Sweet, let's prepare a third trick!");
-  XBT_INFO("Going to sleep for 3 seconds");
-
-  if (MSG_process_sleep(3) != MSG_OK)
-     xbt_die("What's going on??? I failed to sleep!");
-  XBT_INFO("Send a third exception (cancellation)");
-  SIMIX_process_throw(victim_process, cancel_error, 0, "Third Trick: Let's pretend this time that someone canceled something");
-
-  XBT_INFO("OK, goodbye now.");
-  return 0;
-}
-
-int main(int argc, char *argv[]) {
-  msg_error_t res = MSG_OK;
-
-  MSG_init(&argc, argv);
-  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_process_create("terrorist", terrorist, NULL, MSG_get_host_by_name("Jacquelin"));
-
-  // Launch the simulation
-  res = MSG_main();
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res != MSG_OK;
-}
diff --git a/examples/msg/exception/exception.tesh b/examples/msg/exception/exception.tesh
deleted file mode 100644 (file)
index 4dff602..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#! ./tesh
-
-p Testing the remote exception raising feature
-
-! output sort 19
-$ $SG_TEST_EXENV exception/exception ${srcdir:=.}/../platforms/platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=exception/cutpath:1"
-> [  0.000000] (1:terrorist@Jacquelin) Let's create a victim.
-> [  0.000000] (2:victim@Jacquelin) Let's work.
-> [  0.000000] (1:terrorist@Jacquelin) Going to sleep for 1 second
-> [  1.000000] (1:terrorist@Jacquelin) Send a first exception (host failure)
-> [  1.000000] (1:terrorist@Jacquelin) Sweet, let's prepare a second trick!
-> [  1.000000] (1:terrorist@Jacquelin) Going to sleep for 2 seconds
-> [  1.000000] (2:victim@Jacquelin) The MSG_task_execute caught the exception for me and returned 8)
-> [  1.000000] (2:victim@Jacquelin) Let's get suspended.
-> [  3.000000] (1:terrorist@Jacquelin) Send a second exception (host failure)
-> [  3.000000] (1:terrorist@Jacquelin) Sweet, let's prepare a third trick!
-> [  3.000000] (1:terrorist@Jacquelin) Going to sleep for 3 seconds
-> [  3.000000] (2:victim@Jacquelin) The received exception resumed my suspension. Good. Here is it:  ----------------------->8----
-> ** SimGrid: UNCAUGHT EXCEPTION received on exception/exception(2): category: action canceled; value: 0
-> ** Canceled
-> ** Thrown by maestro() on process 0
-> [  0.000000] (0:maestro@) Configuration change: Set 'exception/cutpath' to '1'
-> [  3.000000] (2:victim@Jacquelin) Canceled
->
-> **   In SIMIX_execution_finish() at smx_host.cpp
-> **   In SIMIX_post_host_execute() at smx_host.cpp
-> **   In SIMIX_run() at src/simix/smx_global.cpp:482 (discriminator smx_global.cpp:482 (discriminator 1)
-> **   In SIMIX_simcall_exit() at popping.cpp
-> **   In MSG_main() at msg_global.cpp
-> **   In main() at exception.c
-> [  3.000000] (2:victim@Jacquelin) (end of the second exception) ----8<------------------------
-> [  3.000000] (2:victim@Jacquelin) Let's sleep for 10 seconds.
-> [  6.000000] (1:terrorist@Jacquelin) Send a third exception (cancellation)
-> [  6.000000] (1:terrorist@Jacquelin) OK, goodbye now.
-> [  6.000000] (2:victim@Jacquelin) The MSG_process_sleep caught the exception for me and returned 8)
-> [  6.000000] (2:victim@Jacquelin) Let's try a last time to do something on something
-> [ 16.000000] (2:victim@Jacquelin) That's enough now. I quit.
-> [ 16.000000] (0:maestro@) Simulation time 16