Add mutex lock to protect stl map in C++ wrapper