????1. ?????????
??????????? C++11 codecvt ???????????????????????mbstate_t ????м??????????????????0?????????г????????
????// ???????
????mbstate_t mbst;
????// ????????
????mbstate mbst = {0};
????// ???????
????mbstate mbst = mbstate_t();
???????????????????????????????????????????????????????
???????飺C++?е???????????????????á?
????2. ???? std::thread ????
???????????? boost ???б????? boost ?У????????????? thread ????????????????????????? future??promise???????????????????Boost????????????????????е??????????????д?????
??????????? C++ ??????в??????????????ī????????????????????????κ??м?????????????????????????????????????????????????????????? boost ????????????
???????飺????????????????????????????????????????????????????????
????3. ??????洢??TLS??
?????????????????????
????C++11 ?У????????? thread_local ?洢?????????????? __declspec(thread)????????????????????????????????????????????????ε?????
??????????δ??????????? exe???? xp ?????????????У??????????? dll???? xp ?????г???????? xp ??????? VS ???????????????? x32_dbg ???????????????????????????? fs:[2c]?????? TLS ??????????????????????? https://msdn.microsoft.com/en-us/library/y5f6w579 ??
????On XP systems?? thread_local may not function correctly if a DLL uses thread_local data and it is loaded dynamically via LoadLibrary.
??????????? dll ??????? thread_local????? dll ???????? xp ????? LoadLibrary ????????
?????????????е??
?????????????? LoadLibrary ??????????????????????????????? exe ???????? dll???? dll ?? exe ???????У?????????????У??????? exe ????????????????
?????? DllMain ????? TLS ???? API ????????
??????? xp ??????
???????飺????????????? xp ???
????4. dll ?е???????
????????????????????????????????????????????????????????????????????????????? C# ?е??? dll??????????????????????????????????????????? thread_local???????? xp ????????г??????????????????????????????????????? thread_local ?????λ?????????
?????????2??С??????????????????? C++17 ??????е? std::experimental::filesystem::exists() ????????????????????????????????????????? TLS?????????Щ?????????ī??????????????????
??????????????????????????????????? https://msdn.microsoft.com/en-us/library/y5f6w579 ??
????Starting in C++11?? a static local variable initialization is guaranteed to be thread-safe. This feature is sometimes called magic statics. However?? in a multithreaded application all subsequent assignments must be synchronized. The thread-safe statics feature can be disabled by using the /Zc:threadSafeInit- flag to avoid taking a dependency on the CRT.
?????? C++11 ?У?????????????????????????????ν??“?????”?????????? TLS ???????Щ??????飬????????????????????????????? /Zc:threadSafeInit- ????????????????????ú?????? TLS ?????????? xp ???????????
?????????Щ?????? VS2015 Update 2 ?з??????????????????????? VS ?汾?С?