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/slice2docbook/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/slice2docbook/Main.cpp')
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 4386ceae454..ffac6164b52 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -9,14 +9,26 @@ #include <IceUtil/Options.h> #include <IceUtil/StringUtil.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; 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) { @@ -150,7 +162,8 @@ main(int argc, char* argv[]) int status = EXIT_SUCCESS; - SignalHandler sigHandler; + IceUtil::CtrlCHandler ctrlCHandler; + ctrlCHandler.setCallback(interruptedCallback); for(vector<string>::size_type idx = 1; idx < args.size(); ++idx) { @@ -184,12 +197,19 @@ 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) { - SignalHandler::addFile(docbook); - Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields); if(!gen) { @@ -201,5 +221,14 @@ main(int argc, char* argv[]) p->destroy(); + { + IceUtil::StaticMutex::Lock lock(_mutex); + + if(_interrupted) + { + return EXIT_FAILURE; + } + } + return status; } |