hanchenye-llvm-project/libcxx/test/atomics
Dan Albert 0bb696800f PR20546: Fix tests for compare_exchange_weak.
These calls are allowed to fail spuriously.

29.6.5.25:

    Remark: A weak compare-and-exchange operation may fail spuriously.
    That is, even when the contents of memory referred to by expected
    and object are equal, it may return false and store back to expected
    the same memory contents that were originally there. [ Note: This
    spurious failure enables implementation of compare and-exchange on a
    broader class of machines, e.g., load-locked store-conditional
    machines. A consequence of spurious failure is that nearly all uses
    of weak compare-and-exchange will be in a loop.

To fix this, we replace any assert() that expects
std::atomic::compare_exchange_weak() to return true with a loop. If the
call does not return true within N runs (with N currently equal to 10),
then the test fails.

http://llvm.org/bugs/show_bug.cgi?id=20546

llvm-svn: 217319
2014-09-06 20:38:25 +00:00
..
atomics.fences Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
atomics.flag Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
atomics.general
atomics.lockfree Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
atomics.order Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
atomics.syn
atomics.types.generic PR20546: Fix tests for compare_exchange_weak. 2014-09-06 20:38:25 +00:00
atomics.types.operations PR20546: Fix tests for compare_exchange_weak. 2014-09-06 20:38:25 +00:00
version.pass.cpp Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00