Освобождается ли мьютекс, используемый в методе GetValues()
, до или после создания копии экземпляра dummy
?
class Protect
{};
class Test
{
public:
Protect GetValues() const;
private:
Protect m_protVal;
Mutex m_mutex;
};
Protect Test::GetValues() const
{
CLockGuard lock(m_mutex);
return m_protVal;
}
int main(int argc, char** argv)
{
Test myTestInstance;
Protect dummy = myTestInstance.GetValues();
}
Предположим, что CLockGuard
и Mutex
являются стандартными классами, поставляемыми с boost lib.