From 51ee7620f82e4232baf587ee052001751c23e481 Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Fri, 2 Jan 2009 15:16:46 -0330 Subject: Merged with R3_3_branch --- cpp/src/slice2cpp/Main.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'cpp/src/slice2cpp/Main.cpp') diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 0fef7634add..f23c45a9739 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -8,13 +8,25 @@ // ********************************************************************** #include +#include +#include #include -#include #include using namespace std; using namespace Slice; +static IceUtil::StaticMutex _mutex = ICE_STATIC_MUTEX_INITIALIZER; +static bool _interrupted = false; + +void +interruptedCallback(int signal) +{ + IceUtil::StaticMutex::Lock lock(_mutex); + + _interrupted = true; +} + void usage(const char* n) { @@ -149,10 +161,11 @@ main(int argc, char* argv[]) int status = EXIT_SUCCESS; + IceUtil::CtrlCHandler ctrlCHandler; + ctrlCHandler.setCallback(interruptedCallback); + for(i = args.begin(); i != args.end(); ++i) { - SignalHandler sigHandler; - if(depend) { Preprocessor icecpp(argv[0], *i, cppArgs); @@ -213,6 +226,15 @@ main(int argc, char* argv[]) u->destroy(); } } + + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } } return status; -- cgit v1.2.3