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/slice2freezej/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/slice2freezej/Main.cpp')
-rw-r--r-- | cpp/src/slice2freezej/Main.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index 709de7a58cb..b565d190a3c 100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -9,9 +9,10 @@ #include <IceUtil/Options.h> #include <IceUtil/StringUtil.h> +#include <IceUtil/CtrlCHandler.h> +#include <IceUtil/StaticMutex.h> #include <Slice/Preprocessor.h> #include <Slice/JavaUtil.h> -#include <Slice/SignalHandler.h> #ifdef __BCPLUSPLUS__ # include <iterator> @@ -22,6 +23,17 @@ using namespace Slice; using namespace IceUtil; using namespace IceUtilInternal; +static IceUtil::StaticMutex _mutex = ICE_STATIC_MUTEX_INITIALIZER; +static bool _interrupted = false; + +void +interruptedCallback(int signal) +{ + IceUtil::StaticMutex::Lock lock(_mutex); + + _interrupted = true; +} + struct DictIndex { string member; @@ -1421,7 +1433,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) { @@ -1464,6 +1477,15 @@ main(int argc, char* argv[]) return EXIT_FAILURE; } } + + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } } if(depend) @@ -1521,5 +1543,14 @@ main(int argc, char* argv[]) u->destroy(); + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } + return status; } |