summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Preprocessor.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-11-19 11:06:31 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-11-19 11:06:31 -0330
commit7f24f7fd2361ff5d43775e4523bc78ffdb108306 (patch)
tree62d26962d53259163ee997a7172af5a8fb550a1d /cpp/src/Slice/Preprocessor.cpp
parentBug 3541 - Slice signal handling unsafe (diff)
downloadice-7f24f7fd2361ff5d43775e4523bc78ffdb108306.tar.bz2
ice-7f24f7fd2361ff5d43775e4523bc78ffdb108306.tar.xz
ice-7f24f7fd2361ff5d43775e4523bc78ffdb108306.zip
Added use of CtrlChandler to slice compilers
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rw-r--r--cpp/src/Slice/Preprocessor.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 8c7f1983413..1d331f24387 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -29,6 +29,19 @@ using namespace std;
using namespace Slice;
//
+// Callback for Crtl-C signal handling
+//
+static Preprocessor* _preprocess = 0;
+
+static void closeCallback()
+{
+ if(_preprocess != 0)
+ {
+ _preprocess->close();
+ }
+}
+
+//
// mcpp defines
//
namespace Slice
@@ -51,6 +64,8 @@ Slice::Preprocessor::Preprocessor(const string& path, const string& fileName, co
_args(args),
_cppHandle(0)
{
+ _preprocess = this;
+ SignalHandler::setCloseCallback(closeCallback);
}
Slice::Preprocessor::~Preprocessor()
@@ -437,6 +452,9 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
bool
Slice::Preprocessor::close()
{
+ _preprocess = 0;
+ SignalHandler::setCloseCallback(0);
+
if(_cppHandle != 0)
{
int status = fclose(_cppHandle);