History log of /external/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cedb7fcc10556aaf4302917913c672b1bc6a1db0 06-Feb-2013 Daniel Dunbar <daniel@zuster.org> [tests] One last batch of XFAILs, for tests using new symbols added to libc++.

- As of this commit, the test suite should now fully pass on both darwin11 and
darwin12 when testing against either a locally built libc++ or the system libc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
5fec82dc0db3623546038e4a86baa44f749e554f 30-Jul-2012 Howard Hinnant <hhinnant@apple.com> Implement [util.smartptr.shared.atomic]. This is the last unimplemented
section in libc++. This requires a recompiled dylib. Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.

The implementation is not lock free. After considerable thought, I know of no
way to make the implementation lock free. Ideas welcome along that front. But
changing the ABI of shared_ptr is not on the table at this point.

The mutex used to lock these function is encapsulated by std::__sp_mut. The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members. Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex. That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.

I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks. Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait). In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).

The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr. The constant 16 is a ball-park reasonable space/time
tradeoff.

std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function. I had thought we had already done this, but I was mistaken.

All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp