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/slice2html/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/slice2html/Main.cpp')
-rw-r--r-- | cpp/src/slice2html/Main.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index d7a3b1911bc..fb5fcb9a2d3 100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp @@ -8,8 +8,9 @@ // ********************************************************************** #include <IceUtil/Options.h> +#include <IceUtil/CtrlCHandler.h> +#include <IceUtil/StaticMutex.h> #include <Slice/Preprocessor.h> -#include <Slice/SignalHandler.h> #include <Gen.h> #include <stdlib.h> @@ -17,6 +18,17 @@ using namespace std; using namespace Slice; using namespace IceUtil; +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) { @@ -173,7 +185,8 @@ main(int argc, char* argv[]) int status = EXIT_SUCCESS; - SignalHandler sigHandler; + IceUtil::CtrlCHandler ctrlCHandler; + ctrlCHandler.setCallback(interruptedCallback); for(vector<string>::size_type idx = 0; idx < args.size(); ++idx) { @@ -207,6 +220,15 @@ main(int argc, char* argv[]) p->destroy(); return EXIT_FAILURE; } + + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } } if(status == EXIT_SUCCESS && !preprocess) @@ -230,5 +252,14 @@ main(int argc, char* argv[]) p->destroy(); + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } + return status; } |