Fix race conditions in test class used throughout the std::thread tests.
authorEric Fiselier <eric@efcs.ca>
Thu, 2 Apr 2015 21:12:17 +0000 (21:12 +0000)
committerEric Fiselier <eric@efcs.ca>
Thu, 2 Apr 2015 21:12:17 +0000 (21:12 +0000)
commit9a37bc91d2d8a60f7872546f72d98123ae2288f6
tree8df97715525cbdc42d0eaf109fe45dd7f5dec1d1
parent4453d2185c43fafee3c74ad95ecbd87d8b2e97ef
Fix race conditions in test class used throughout the std::thread tests.

The test class 'G' reads and writes to the same static variables in its
constructor, destructor and call operator. When threads are
constructed using `std::thread t((G()))` there is a race condition between the
destruction of the temporary and the execution of `G::operator()()`.

The fix is to simply create the input before creating the thread.

llvm-svn: 233946
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp