In C#/Java I can easily make any thread-unsafe code to be thread-safe. I just introduce special "lockObj" and use it like that:
private object lockObj = new object();
void ThreadSafeMethod()
{
lock (lockObj)
{
// work with thread-unsafe code
}
}
(some people just using lock (this)
but this is not recomended)
What is easiest and fastest C++ equivalent? I can use C++11.