In msvs 2015, the _locking function has a defect: if it is called with the _LK_NBLCK parameter, then if it is impossible to block a specified section, the function should return control. However, it performs a single wait cycle of 1000ms. In my case, this is critical (there are significant delays). Actually, the question is how to solve this problem (maybe there is a fix for the defect, or there is an opportunity to use some other function).
C:\Program Files (x86)\Windows Kits\10\Source\10.0.10240.0\ucrt\lowio\locking.cpp:59. At the end of the attempt loop,Sleep(1000);worthSleep(1000);which in any case is executed, even with one attempt. Then the fourth option is to copy the code for this lock to the project, correct and use it. - Vladimir Gamalyan