Implement LWG-3343 Ordering of calls to unlock() and notify_all() in Effects element of notify_all_at_thread_exit() should be reversed#5912
Conversation
…ad_exit_lwg3343.pass.cpp
Is this test of any value? I understand the intent (trying to reproduce the example from LWG-3343), but it does not appear to do so very well. It has implicit timing requirements that invalidate its effect IMO. If for nothing else, then for
We could create one by adding side effects to the destructor of TLS object, but that still does not avoid the timing requirements problem. To observe the order of |
Enabling it seems reasonable to me - it may detect issues, doesn’t produce false positives, and doesn’t consume many resources, so it doesn’t meet our bar for skipping a test, IMO. If it’s not effective enough, we can write a new one.
I don’t know of any way to control context switches, and it seems impossible to simulate a context switch between |
|
As long as they aren't flaky-failing, I prefer to keep as many libcxx tests enabled as possible. It's okay if we can't find a way to exercise every part of the fix. Having confidence that the source is fixed, and not disrupting existing test coverage, is sufficient. |
unlock() and notify_all() in Effects element of notify_all_at_thread_exit() should be reversed
BTW, I think we had marked it as SKIPPED because it had failed in the past. We only use SKIPPED for sporadic failures, arch-specific failures (which we can't easily express otherwise), and things like "this test takes forever or hangs". |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |

Swap mutex unlock and condition_variable notify_all in
_Cnd_do_broadcast_at_thread_exit.Fixes #5863 (at least partially)
The issue LWG-3343 mentions that he notification is additionally sequenced after destructors of all objects in thread-local storage; it is not clear to me how that is checkable (see #5863 (comment))