summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freezej/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2freezej/Main.cpp')
-rw-r--r--cpp/src/slice2freezej/Main.cpp35
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;
}