Skip to content
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

xlock.cpp: Should we use SRWLOCK instead of CRITICAL_SECTION? #3521

Open
frederick-vs-ja opened this issue Mar 3, 2023 · 2 comments
Open
Labels
performance Must go faster

Comments

@frederick-vs-ja
Copy link
Contributor

In #2317, MSVC STL dropped support for Windows Vista and make SRWLOCK unconditionally used for mutex. However, there're still some implementation details using CRITICAL_SECTION, all of which can be found in xlock.cpp (via xmtx.hpp and xmtx.cpp).

It seems that switching to SRWLOCK doesn't affect ABI (as support for Vista has been dropped). Should we do this?

@frederick-vs-ja frederick-vs-ja added the question Further information is requested label Mar 3, 2023
@StephanTLavavej StephanTLavavej added performance Must go faster and removed question Further information is requested labels Mar 3, 2023
@StephanTLavavej
Copy link
Member

I've taken a look at the code - it should be possible, as there shouldn't be any mix-and-match concerns from user code (as xlock.cpp's state is static). However, it must be done with great care, as the helper functions appear on the export surface. That is, the _Mtxinit family is exported from msvcp140.dll for our eternal nemesis, /clr:pure. It should be possible to continue to export them (marked as unused and preserved for ABI) while xlock.cpp switches to using SRWLOCK.

@AlexGuteniev
Copy link
Contributor

Make sure that none of these mutexes are used as recursive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

No branches or pull requests

3 participants