Cleanups: Simplify thread and condition_variable, identify unused dllexports
#3532
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains fairly simple logic transformations - they aren't exactly trivial (as one must consult other code to verify their correctness), but they're far from complicated. There's no behavioral impact, no changes to dllexports, and no interaction with the "unlocked" state of the redist.
_Xtime_diff_to_millis()is unused. We can drop its declaration ininc/xtimec.hand mark its definition insrc/xtime.cppas preserved for bincompat. When doing this, all we need to do is verify that the declaration and the definition contain all of the same annotations (in particular,_CRTIMP2_PUREcontrols dllexporting).thread::detach(), part 1.inc/xthreads.hprovided aninlinehelper_Check_C_return(). Originally, it may have been used widely, but now there's only one usage. We can manually fuse it intothread::detach().thread::detach(), part 2._Thrd_detach()returns either_Thrd_successor_Thrd_error:STL/stl/src/cthread.cpp
Lines 71 to 73 in 16bb556
_Throw_C_error()translates that to_Throw_Cpp_error(_INVALID_ARGUMENT):STL/stl/src/thread0.cpp
Lines 47 to 48 in 16bb556
thread::join()above, and more clearly shows what exception will be thrown._Cnd_timedwait()returns only_Thrd_successor_Thrd_timedout. There's only onereturn, and only two values thatrescan take:STL/stl/src/cond.cpp
Lines 63 to 83 in 16bb556
_Cnd_timedwait(), as we don't need to worry about unexpected return values._Throw_C_error()is unused, so we can drop its declaration and mark its definition as preserved for bincompat.extern "C++"from the declaration ininc/xthreads.h- that's for Standard Library Modules, butsrc/thread0.cppis always built classically.