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 _Lock_at_thread_exit_mutex() be noexcept? #273

Closed
StephanTLavavej opened this issue Nov 9, 2019 · 6 comments · Fixed by #4408
Closed

xlock.cpp: Should _Lock_at_thread_exit_mutex() be noexcept? #273

StephanTLavavej opened this issue Nov 9, 2019 · 6 comments · Fixed by #4408
Labels
enhancement Something can be improved fixed Something works now, yay!

Comments

@StephanTLavavej
Copy link
Member

_Lock_at_thread_exit_mutex() and _Unlock_at_thread_exit_mutex() are separately compiled, but aren't used outside the STL's DLL (or static LIB):

STL/stl/src/xlock.cpp

Lines 123 to 129 in f9b1dcc

extern "C" void _Lock_at_thread_exit_mutex() { // lock the at-thread-exit mutex
_Mtxlock(&mtx[_LOCK_AT_THREAD_EXIT]);
}
extern "C" void _Unlock_at_thread_exit_mutex() { // unlock the at-thread-exit mutex
_Mtxunlock(&mtx[_LOCK_AT_THREAD_EXIT]);
}

STL/stl/src/xnotify.cpp

Lines 31 to 34 in f9b1dcc

_EXTERN_C
void _Lock_at_thread_exit_mutex();
void _Unlock_at_thread_exit_mutex();

Since they aren't exported, I believe that it would be safe (i.e. binary-compatible) to mark them as noexcept, and give them C++ linkage.

It's also possible that there's no point in doing so; because they're extern "C" and we compile with /EHsc, they should already be treated as noexcept.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Nov 9, 2019
@BillyONeal
Copy link
Member

No, they should be deleted :)

@StephanTLavavej
Copy link
Member Author

For vNext, or can that be done in v19?

@BillyONeal
Copy link
Member

If they aren't exported should be doable in v19.

@StephanTLavavej
Copy link
Member Author

What would deletion involve? (i.e. what additional code would be necessary to replace this mechanism?)

@BillyONeal
Copy link
Member

Would probably hook it into the existing locale lock system. Even just moving this stuff into the one .cpp where it's currently used would be an improvement.

@StephanTLavavej
Copy link
Member Author

#4106 actually made them noexcept.

@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved fixed Something works now, yay!
Projects
None yet
2 participants