[PATCH] D50549: [libcxx] [test] Repair thread unsafety in thread tests

Dmitry Vyukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 13 09:56:07 PDT 2018


dvyukov added inline comments.


================
Comment at: test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp:73
         assert(!t0.joinable());
         while (!done) {}
         assert(G::op_run);
----------------
I don't immediately see how the race on n_alive/op_run happens. It seems that the modifications in the thread happen before this line, and modifications in main happen after this line. How can both of them modify the variables at the same time?


https://reviews.llvm.org/D50549





More information about the cfe-commits mailing list