[PATCH] D78956: [WIP][FileCollector] FileCollector::Mutex
Jan Korous via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 12:55:47 PDT 2020
jkorous created this revision.
jkorous added a reviewer: JDevlieghere.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
IIUC we should synchronize read and write access to `VFSWriter`.
It almost feels like we might want to keep `FileCollector` thread-unsafe and move the responsibility (and the mutex) to client code.
https://reviews.llvm.org/D78956
Files:
llvm/include/llvm/Support/FileCollector.h
llvm/lib/Support/FileCollector.cpp
Index: llvm/lib/Support/FileCollector.cpp
===================================================================
--- llvm/lib/Support/FileCollector.cpp
+++ llvm/lib/Support/FileCollector.cpp
@@ -123,6 +123,9 @@
}
std::error_code FileCollector::copyFiles(bool StopOnError) {
+ // TODO: We're reading from VFSWriter so we should lock the Mutex, right?
+ std::lock_guard<std::mutex> lock(Mutex);
+
for (auto &entry : VFSWriter.getMappings()) {
// Create directory tree.
if (std::error_code EC =
Index: llvm/include/llvm/Support/FileCollector.h
===================================================================
--- llvm/include/llvm/Support/FileCollector.h
+++ llvm/include/llvm/Support/FileCollector.h
@@ -59,6 +59,7 @@
}
protected:
+ /// FIXME: Seems more like it synchronizes everything (...accessible via public interface).
/// Synchronizes adding files.
std::mutex Mutex;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78956.260410.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200427/c4c524e5/attachment.bin>
More information about the llvm-commits
mailing list