[llvm-commits] [llvm] r73620 - /llvm/trunk/lib/VMCore/Value.cpp
Chris Lattner
clattner at apple.com
Wed Jun 17 11:49:34 PDT 2009
On Jun 17, 2009, at 10:37 AM, Owen Anderson wrote:
> Author: resistor
> Date: Wed Jun 17 12:36:57 2009
> New Revision: 73620
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73620&view=rev
> Log:
> Protect the ValueHandle table.
Owen, can you please add an RAII object to handle the locking and
unlocking?
Instead of:
>
> // Get the linked list base, which is guaranteed to exist since the
> // HasValueHandle flag is set.
> + if (llvm_is_multithreaded()) ValueHandlesLock->reader_acquire();
> ValueHandleBase *Entry = (*ValueHandles)[V];
> + if (llvm_is_multithreaded()) ValueHandlesLock->reader_release();
> assert(Entry && "Value bit set but no entries exist");
it would be very nice to have:
{
RWReaderLocker X(*ValueHandlesLock);
Entry = (*ValueHandles)[V];
}
...
-Chris
More information about the llvm-commits
mailing list