[LLVMdev] RFC: Atomics.h
Luke Dalessandro
luked at cs.rochester.edu
Sun May 17 05:23:09 PDT 2009
Owen Anderson wrote:
>
> On May 16, 2009, at 7:47 PM, Luke Dalessandro wrote:
>
>> Also, atomic ops are usually pretty low level things used for
>> nonblocking algorithms or to build higher level locking constructs. Is
>> that the plan here too? It seems like you'd want to avoid anything too
>> fancy since LLVM has to run on so many different architectures with
>> their variety of memory semantics, etc.
>
> I totally agree. However, at least one case of thread-unsafety
> (ManagedStatic), has proven very-difficult-to-impossible to implement
> correctly without using lower-level operations.
>
Yes, double-checked locking is a pain. There's a C++ safe implementation
in
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
in the "Making it work with explicit memory barriers" section. As far as
I know, it is still considered to work.
Luke
> --Owen
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list