While investigating the flaky tests on the mac backdeployment targets
it seems the tests are different than suggested in the LWG issue.
That tests "does work", grabs the mutex, marks the task as done, and
finally calls the notifier.
Our test emulated "does work" after the notification, effectively
sleeping with a lock held. This has been fixed.
A second improvement is that the test fails when, due to OS
scheduling, the condition variable is not used in the main thread.
During discussing the approach of the patch with @ldionne, he
noticed the real reason why the test is flaky; the Apple
backdeployment targets use a dylib, which does not contain the
fix. So the test can't be tested on that platform; it only
proves the LWG issue was correct and the Standard contained
a bug.
I think this needs to be marked as UNSUPPORTED on the back-deployment target. The fix is in the dylib so we should expect it to fail on back-deployment targets.
I can't believe I didn't think of that earlier, I'm sorry I hadn't realized the original fix was in thread.cpp, not in <thread>.