From 436766eca2fdb00afa1e62fe7c8da0d67a57ee78 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 7 Dec 2014 15:12:22 +0000 Subject: Add mutex around Slice::Preprocessor calls as they seem to be demonstrably not thread safe --- project2/ice/sliceCompile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project2/ice/sliceCompile.cpp b/project2/ice/sliceCompile.cpp index 32831ac..b879965 100644 --- a/project2/ice/sliceCompile.cpp +++ b/project2/ice/sliceCompile.cpp @@ -1,6 +1,9 @@ #include #include "sliceCompile.h" #include +#include + +std::mutex slicePreprocessor; SliceCompile::SliceCompile(const boost::filesystem::path & slice, const IceCompile::Deps & dep) : IceCompile(slice, dep) @@ -11,6 +14,7 @@ unsigned int SliceCompile::build(const boost::filesystem::path & in, FILE * out) const { std::vector cppArgs; + std::lock_guard lock(slicePreprocessor); Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slice2project2", in.string(), cppArgs); FILE * cppHandle = icecpp->preprocess(false); -- cgit v1.2.3