summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <randomdan@akira.random.lan>2014-12-07 15:12:22 +0000
committerDan Goodliffe <randomdan@akira.random.lan>2014-12-07 15:12:22 +0000
commitcf7799e4184cab8eec5ce3ef7f8f303265e3970e (patch)
treee5631955f451450927bf753a285f6d7bddc30d76
parentCount components created in all stages and only compile/link/load resulting c... (diff)
downloadproject2-cf7799e4184cab8eec5ce3ef7f8f303265e3970e.tar.bz2
project2-cf7799e4184cab8eec5ce3ef7f8f303265e3970e.tar.xz
project2-cf7799e4184cab8eec5ce3ef7f8f303265e3970e.zip
Add mutex around Slice::Preprocessor calls as they seem to be demonstrably not thread safe
-rw-r--r--project2/ice/sliceCompile.cpp4
1 files changed, 4 insertions, 0 deletions
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 <pch.hpp>
#include "sliceCompile.h"
#include <scopeObject.h>
+#include <mutex>
+
+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<std::string> cppArgs;
+ std::lock_guard<std::mutex> lock(slicePreprocessor);
Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slice2project2", in.string(), cppArgs);
FILE * cppHandle = icecpp->preprocess(false);