]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Use sig_atomic_t for opt::exit_request.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 20 May 2011 15:23:48 +0000 (17:23 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 20 May 2011 15:32:21 +0000 (17:32 +0200)
main.cpp
options.cpp
options.h

index b924349cb325121aa3b7e67c830529ec7897fafd..bce9749dd203324b21ac2985f39a97427d7d4068 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1,7 +1,7 @@
 #include <cerrno>
 #include <cerrno>
+#include <csignal>
 #include <cstring>              // strchr
 #include <iostream>
 #include <cstring>              // strchr
 #include <iostream>
-#include <signal.h>
 #include <stdexcept>
 #include <msg/msg.h>
 #include <xbt/log.h>
 #include <stdexcept>
 #include <msg/msg.h>
 #include <xbt/log.h>
@@ -141,7 +141,7 @@ static void signal_handler(int /*sig*/)
         XBT_CRITICAL(">>>>>>>>>>"
                      " caught CTRL-C: global exit requested "
                      "<<<<<<<<<<");
         XBT_CRITICAL(">>>>>>>>>>"
                      " caught CTRL-C: global exit requested "
                      "<<<<<<<<<<");
-        opt::exit_request = true;
+        opt::exit_request = 1;
     } else {
         XBT_CRITICAL(">>>>>>>>>>"
                      " caught CTRL-C for the 2nd time: exit immediately "
     } else {
         XBT_CRITICAL(">>>>>>>>>>"
                      " caught CTRL-C for the 2nd time: exit immediately "
index 3e0f92d764a29cc695522d5a3dd770e99481a6c8..373f4c633504b68fe02a907a9958e37f07fb9fd3 100644 (file)
@@ -39,7 +39,7 @@ namespace opt {
 
     // Simulation parameters
     int log_rate = 1;
 
     // Simulation parameters
     int log_rate = 1;
-    bool exit_request = false;
+    volatile sig_atomic_t exit_request = 0;
 
     // Platform and deployment
     std::string platform_file;
 
     // Platform and deployment
     std::string platform_file;
index 604d1781ebf1deb00ca901de2ae2bcef971a821f..35334a5cf585e393cb492a0fc221ae2f5916aa9a 100644 (file)
--- a/options.h
+++ b/options.h
@@ -1,6 +1,7 @@
 #ifndef OPTIONS_H
 #define OPTIONS_H
 
 #ifndef OPTIONS_H
 #define OPTIONS_H
 
+#include <csignal>              // sig_atomic_t
 #include <string>
 #include "cost_func.h"
 #include "named_object_list.h"
 #include <string>
 #include "cost_func.h"
 #include "named_object_list.h"
@@ -23,7 +24,7 @@ namespace opt {
 
     // Simulation parameters
     extern int log_rate;
 
     // Simulation parameters
     extern int log_rate;
-    extern bool exit_request;
+    extern volatile sig_atomic_t exit_request;
 
     // Platform and deployment
     extern std::string platform_file;
 
     // Platform and deployment
     extern std::string platform_file;