diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-01-02 15:16:46 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-01-02 15:16:46 -0330 |
commit | 51ee7620f82e4232baf587ee052001751c23e481 (patch) | |
tree | 08baaf92bddeca3f33acfe1bb38620606de7a99b /cpp/src/slice2cs/Main.cpp | |
parent | The server now accepts anonymous clients. (diff) | |
download | ice-51ee7620f82e4232baf587ee052001751c23e481.tar.bz2 ice-51ee7620f82e4232baf587ee052001751c23e481.tar.xz ice-51ee7620f82e4232baf587ee052001751c23e481.zip |
Merged with R3_3_branch
Diffstat (limited to 'cpp/src/slice2cs/Main.cpp')
-rw-r--r-- | cpp/src/slice2cs/Main.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp index 770ee8b5ea4..6ec7e7d8c6a 100644 --- a/cpp/src/slice2cs/Main.cpp +++ b/cpp/src/slice2cs/Main.cpp @@ -8,13 +8,25 @@ // ********************************************************************** #include <IceUtil/Options.h> +#include <IceUtil/CtrlCHandler.h> +#include <IceUtil/StaticMutex.h> #include <Slice/Preprocessor.h> -#include <Slice/SignalHandler.h> #include <Gen.h> 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) { @@ -144,10 +156,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); @@ -222,6 +235,15 @@ main(int argc, char* argv[]) p->destroy(); } } + + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } } return status; |