Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement quiet exit (fixes #10045)
authormarc fuentes <marc.fuentes@inria.fr>
Tue, 29 Mar 2011 12:07:53 +0000 (14:07 +0200)
committermarc fuentes <marc.fuentes@inria.fr>
Tue, 29 Mar 2011 12:10:05 +0000 (14:10 +0200)
src/simix/smx_global.c
src/surf/surf_config.c

index 72ea2c7..b888675 100644 (file)
@@ -35,10 +35,16 @@ extern void smx_ctx_raw_new_sr(void);
 /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
 #include <signal.h>
 
+int _surf_do_verbose_exit = 1;
 static void _XBT_CALL inthandler(int ignored)
 {
-  XBT_INFO("CTRL-C pressed. Displaying status and bailing out");
-  SIMIX_display_process_status();
+  if ( _surf_do_verbose_exit ) {
+     XBT_INFO("CTRL-C pressed. Displaying status and bailing out");
+     SIMIX_display_process_status();
+  }
+  else {
+     XBT_INFO("CTRL-C pressed. bailing out without displaying because verbose-exit disabled");
+  }
   exit(1);
 }
 
index 6e5b341..0fff09f 100644 (file)
@@ -192,6 +192,14 @@ static void _surf_cfg_cb_model_check(const char *name, int pos)
   }
 }
 
+extern int _surf_do_verbose_exit;
+
+static void _surf_cfg_cb_verbose_exit(const char *name, int pos)
+{
+  _surf_do_verbose_exit = xbt_cfg_get_int(_surf_cfg_set, name);
+}
+
+
 static void _surf_cfg_cb_context_factory(const char *name, int pos)
 {
   smx_context_factory_name = xbt_cfg_get_string(_surf_cfg_set, name);
@@ -347,12 +355,21 @@ void surf_config_init(int *argc, char **argv)
                      "Activate the model-checking of the \"simulated\" system (EXPERIMENTAL -- msg only for now)",
                      xbt_cfgelm_int, &default_value_int, 0, 1,
                      _surf_cfg_cb_model_check, NULL);
+    
     /*
        FIXME: this function is not setting model-check to it's default value because
        internally it calls to variable->cb_set that in this case is the function 
-       _surf_cfg_cb_model_check which sets it's value to 1 (instead of the defalut value 0)
+       _surf_cfg_cb_model_check which sets it's value to 1 (instead of the default value 0)
        xbt_cfg_set_int(_surf_cfg_set, "model-check", default_value_int); */
 
+    /* do verbose-exit */
+    default_value_int = 0;
+    xbt_cfg_register(&_surf_cfg_set, "verbose-exit",
+                     "Activate the \"do nothing\" mode in Ctrl-C",
+                     xbt_cfgelm_int, &default_value_int, 0, 1,
+                     _surf_cfg_cb_verbose_exit, NULL);
+    
+    
     /* context factory */
     default_value = xbt_strdup("ucontext");
     xbt_cfg_register(&_surf_cfg_set, "contexts/factory",