-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Implement LWG-3343 Ordering of calls to unlock() and notify_all() in Effects element of notify_all_at_thread_exit() should be reversed
#5912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
libc++ has already speculatively implemented this fix, and I believe we can reuse their test case. Specifically, we should delete these lines: STL/tests/libcxx/expected_results.txt Lines 612 to 615 in 5459853
(Regardless of whether we write our own test, I think we should enable this one.)
This part seems more like a wording change to me, but I’m not entirely sure, and I haven't found relevant tests either. |
…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
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))