aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-17 22:23:31 +0000
committerOwen Anderson <resistor@mac.com>2009-06-17 22:23:31 +0000
commitd06a035bb535d48b3b98b439acd6bb4ca443e1b4 (patch)
tree3c35a8c5fdda5c891e2350046748f14276158d83 /include/llvm
parent1dc3bc0978813f6402e37023b6d0d279b81f8b37 (diff)
downloadexternal_llvm-d06a035bb535d48b3b98b439acd6bb4ca443e1b4.zip
external_llvm-d06a035bb535d48b3b98b439acd6bb4ca443e1b4.tar.gz
external_llvm-d06a035bb535d48b3b98b439acd6bb4ca443e1b4.tar.bz2
Protect the GC table in Function.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/System/RWMutex.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/System/RWMutex.h b/include/llvm/System/RWMutex.h
index 6ac7aa3..8967e9e 100644
--- a/include/llvm/System/RWMutex.h
+++ b/include/llvm/System/RWMutex.h
@@ -79,6 +79,20 @@ namespace llvm
/// @}
};
+ /// ScopedReader - RAII acquisition of a writer lock
+ struct ScopedReader {
+ RWMutex* mutex;
+
+ explicit ScopedReader(RWMutex* m) {
+ mutex = m;
+ mutex->reader_acquire();
+ }
+
+ ~ScopedReader() {
+ mutex->reader_release();
+ }
+ };
+
/// ScopedWriter - RAII acquisition of a writer lock
struct ScopedWriter {
RWMutex* mutex;