I suggest using std::mutex