diff options
author | Dan Goodliffe <randomdan@akira.random.lan> | 2014-12-07 15:12:22 +0000 |
---|---|---|
committer | Dan Goodliffe <randomdan@akira.random.lan> | 2014-12-07 15:12:22 +0000 |
commit | 436766eca2fdb00afa1e62fe7c8da0d67a57ee78 (patch) | |
tree | e5631955f451450927bf753a285f6d7bddc30d76 | |
parent | Count components created in all stages and only compile/link/load resulting c... (diff) | |
download | project2-436766eca2fdb00afa1e62fe7c8da0d67a57ee78.tar.bz2 project2-436766eca2fdb00afa1e62fe7c8da0d67a57ee78.tar.xz project2-436766eca2fdb00afa1e62fe7c8da0d67a57ee78.zip |
Add mutex around Slice::Preprocessor calls as they seem to be demonstrably not thread safe
-rw-r--r-- | project2/ice/sliceCompile.cpp | 4 |
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); |