aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/System
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
commitb983d67465a939c43173e381f9063d9d9245f45b (patch)
tree3c35a8c5fdda5c891e2350046748f14276158d83 /include/llvm/System
parentbf823e75907c81d0ba74b7aff9d34131587c1d8b (diff)
downloadexternal_llvm-b983d67465a939c43173e381f9063d9d9245f45b.zip
external_llvm-b983d67465a939c43173e381f9063d9d9245f45b.tar.gz
external_llvm-b983d67465a939c43173e381f9063d9d9245f45b.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/System')
-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;