Fix pthread locking and remove defunctional support for static lock init.