Currently studying about std::mutex
and would love some help. If I've a code that looks like -
....
if(returnBoolValue())
{
std::lock_guard<std::mutex> lock(mutex_var);
....
....
}
....
is the std::lock_guard
guarding the function returning the value inside if condition? ie. returnBoolValue()
And how should I improve it so that function call is inside the guard as well, if possible?
std::mutex
- http://en.cppreference.com/w/cpp/thread/mutexstd::lock_guard
- http://en.cppreference.com/w/cpp/thread/lock_guard