summaryrefslogtreecommitdiff
path: root/cpp/src/slice2html/Gen.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/slice2html/Gen.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/slice2html/Gen.cpp')
-rw-r--r--cpp/src/slice2html/Gen.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp
index 91a114601de..3be0eecb3e2 100644
--- a/cpp/src/slice2html/Gen.cpp
+++ b/cpp/src/slice2html/Gen.cpp
@@ -30,6 +30,20 @@ using namespace Slice;
using namespace IceUtil;
using namespace IceUtilInternal;
+//
+// Callback for Crtl-C signal handling
+//
+static GeneratorBase* _genBase = 0;
+
+static void closeCallback()
+{
+ if(_genBase != 0)
+ {
+ _genBase->closeStream();
+ }
+}
+
+
namespace Slice
{
@@ -38,6 +52,8 @@ generate(const UnitPtr& unit, const string& dir, const string& header, const str
const string& indexHeader, const string& indexFooter, const string& imageDir, const string& logoURL,
const string& searchAction, unsigned indexCount, unsigned warnSummary)
{
+ SignalHandler::setCloseCallback(closeCallback);
+
unit->mergeModules();
//
@@ -87,6 +103,8 @@ generate(const UnitPtr& unit, const string& dir, const string& header, const str
GeneratorBase::setSymbols(tocv.symbols());
PageVisitor v(files);
unit->visit(&v, false);
+
+ SignalHandler::setCloseCallback(0);
}
}
@@ -196,10 +214,12 @@ Slice::GeneratorBase::setSymbols(const ContainedList& symbols)
Slice::GeneratorBase::GeneratorBase(XMLOutput& o, const Files& files)
: _out(o), _files(files)
{
+ _genBase = this;
}
Slice::GeneratorBase::~GeneratorBase()
{
+ _genBase = 0;
}
//
@@ -1242,7 +1262,7 @@ Slice::GeneratorBase::getLogoURL()
void
Slice::GeneratorBase::openStream(const string& path)
{
- SignalHandler::addFile(path);
+ SignalHandler::addFileForCleanup(path);
_out.open(path.c_str());
if(!_out.isOpen())