On a final positive note: I didn't notice any real regressions using your code
LMAO. In fact, there were errors in the code, and in some cases the locks did not work correctly, and sometimes my games crashed as a result. It seems like in v6 I was able to fix errors and improve the code a little. Despite the simplicity of locks, their debugging may not be so simple, and errors may be hidden.