diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-17 22:23:31 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-17 22:23:31 +0000 |
commit | d06a035bb535d48b3b98b439acd6bb4ca443e1b4 (patch) | |
tree | 3c35a8c5fdda5c891e2350046748f14276158d83 /include/llvm/System | |
parent | 1dc3bc0978813f6402e37023b6d0d279b81f8b37 (diff) | |
download | external_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/System')
-rw-r--r-- | include/llvm/System/RWMutex.h | 14 |
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; |