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 | 5262ff500c3c7a5c6f18db098753f8ee587bd603 (patch) | |
tree | 85747702c5f81e4fb7fe73f5267084b6913fbe17 /slicer | |
parent | Add a late explicit test that interfaces aren't counted (diff) | |
download | slicer-5262ff500c3c7a5c6f18db098753f8ee587bd603.tar.bz2 slicer-5262ff500c3c7a5c6f18db098753f8ee587bd603.tar.xz slicer-5262ff500c3c7a5c6f18db098753f8ee587bd603.zip |
Add mutex around Slice::Preprocessor calls as they seem to be demonstrably not thread safe
Diffstat (limited to 'slicer')
-rw-r--r-- | slicer/slicer/parser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/slicer/slicer/parser.cpp b/slicer/slicer/parser.cpp index 299b178..c7dcec2 100644 --- a/slicer/slicer/parser.cpp +++ b/slicer/slicer/parser.cpp @@ -9,9 +9,12 @@ #include <Slice/CPlusPlusUtil.h> #include <boost/shared_ptr.hpp> #include <boost/filesystem/convenience.hpp> +#include <mutex> namespace fs = boost::filesystem; +std::mutex slicePreprocessor; + namespace Slicer { Slicer::Slicer(FILE * c) : components(0), @@ -506,6 +509,7 @@ namespace Slicer { Slicer::Apply(const boost::filesystem::path & ice, FILE * cpp) { std::vector<std::string> cppArgs; + std::lock_guard<std::mutex> lock(slicePreprocessor); Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slicer", ice.string(), cppArgs); FILE * cppHandle = icecpp->preprocess(false); |