-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cleanups for mutex utilities #3912
Conversation
Also mark `_Thrd_abort`, `_Thrd_create`, `_Thrd_current`, `_Thrd_equal`, `_Thrd_exit`, `_Thrd_start` as `__cdecl`; see MSVC-PR-135576. Wrap `cond.cpp` and `mutex.cpp` in `_EXTERN_C`, copied from `xthreads.h`. This also affects the following: * `struct _Cnd_internal_imp_t` + Good, it was already declared within `_EXTERN_C` in `xthreads.h`. * `enum class __stl_sync_api_modes_enum` + Good, it's used only as a parameter type for `__set_stl_sync_api_mode()` which is `extern "C"`. * `get_srw_lock()` + Good, it's `static`. * `mtx_do_lock()` + Good, it's `static`.
I've pushed changes to address accumulated comments:
I've pushed one enhancement (related to a comment) that hides more declarations from users. We've seen this pattern elsewhere in the STL - there are some separately compiled functions that are used only between separately compiled STL TUs (in the DLL or static LIB), but we marked them as dllexported and declared them for users. We can at least hide them from users, but we have to be careful to preserve the dllexporting:
Finally, there is a major correctness fix. (Check the output of
I've verified that |
I've made another push to remove two redundant assignments ( |
After carefully looking at the control flow, I agree that the assignments were redundant. (Had to consider the impact of loops.) |
@CaseyCarter I've pushed a commit to drop the "used only by" comments as they are superseded by |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
I pushed a merge with |
Thanks for eliminating these unnecessary declarations, and prompting us to fix long-standing codebase inconsistency! 🎉 😸 🚀 |
_Mtx_timedlock
and_Mtx_getconcrtcs
from<xthreads.h>
, as they are not used in the library.mtx_do_lock
in"mutex.cpp"