I was used to support some outdated code, and I see some things that make me confuse me. In some sections of the code, I see that the class instance uses the CMutex instance to synchronize the execution of the method. For instance,
class CClassA : public CObject
{
public:
void DoSomething();
private:
CMutex m_mutex;
}
void CClassA::DoSomething()
{
m_mutex.Lock();
m_mutex.Unlock();
}
Elsewhere in the same project, I found that the code uses CSingleLock
class CClassB : public CObject
{
public:
void DoSomething();
private:
CCriticalSection m_crit;
}
void CClassB::DoSomething()
{
CSingleLock lock(&m_crit);
lock.Lock();
lock.Unlock();
}
MSDN , , CClassB , , , CClassA. , , CSingleLock RAII, , . / ?