refs #1556: fix lock/unlock of mutex/critical sections to assure data integrity of static variables (Binaries (ModelicaStandardLibrary.lib) are unchanged if not compiled as C++.)

git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@7831 7ce873d0-865f-4ce7-a662-4bb36ea78beb