18 January, 2017

The unexpected behavior of std::mutex

Hi there, this time I would like to tell about the issue in Microsoft implementation of std::mutex for VS2013. This night I spent in deep debugging trying to understand why my test is failing with std::mutex. but isn't failing with boost::mutex. The only difference was in calling DllMain() for my DLL. It was looked like somebody secretly called LoadLibrary() during std::mutex::lock(). I was very surprised when found that it's truth (Important: our product has static linking with Microsoft CRT):