aboutsummaryrefslogtreecommitdiff
path: root/src/tracking/change_tracker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tracking/change_tracker.cc')
-rw-r--r--src/tracking/change_tracker.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tracking/change_tracker.cc b/src/tracking/change_tracker.cc
index 1b554aa..ca07214 100644
--- a/src/tracking/change_tracker.cc
+++ b/src/tracking/change_tracker.cc
@@ -82,6 +82,8 @@ bool ChangeTracker::track(const std::string& file_path) {
boost::filesystem::canonical(file_path).string()
};
+ std::unique_lock<std::mutex> guard(this->write_mutex_);
+
auto result = this->children_.emplace(
full_file_path,
std::make_unique<boost::process::child>(
@@ -92,6 +94,8 @@ bool ChangeTracker::track(const std::string& file_path) {
)
);
+ guard.unlock();
+
if ( std::get<EMPLACE_SUCCESS>(result) ) {
boost::filesystem::ifstream file(
std::get<FILE_NAME>(*result.first)