projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fbe0b9a
)
[PECOFF] Make COFFObjectReader thread-safe.
author
Rui Ueyama
<ruiu@google.com>
Wed, 21 May 2014 04:17:05 +0000
(
04:17
+0000)
committer
Rui Ueyama
<ruiu@google.com>
Wed, 21 May 2014 04:17:05 +0000
(
04:17
+0000)
llvm-svn: 209271
lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
patch
|
blob
|
history
diff --git
a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
index
467e5ff
..
2ecb86a
100644
(file)
--- a/
lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ b/
lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@
-33,6
+33,7
@@
#include <algorithm>
#include <map>
+#include <mutex>
#include <set>
#include <vector>
@@
-179,6
+180,7
@@
class BumpPtrStringSaver : public llvm::cl::StringSaver {
public:
const char *SaveString(const char *str) override {
size_t len = strlen(str);
+ std::lock_guard<std::mutex> lock(_allocMutex);
char *copy = _alloc.Allocate<char>(len + 1);
memcpy(copy, str, len + 1);
return copy;
@@
-186,6
+188,7
@@
public:
private:
llvm::BumpPtrAllocator _alloc;
+ std::mutex _allocMutex;
};
// Converts the COFF symbol attribute to the LLD's atom attribute.