// A Mutex allows threads mutually exclusive access to a resource.
//-----------------------------------------------------------------------
class Mutex
{
private:
CRITICAL_SECTION m_mutex;
public:
Mutex() { InitializeCriticalSection(&m_mutex); }
~Mutex() { DeleteCriticalSection(&m_mutex); }
void acquire() { EnterCriticalSection(&m_mutex); }
void release() { LeaveCriticalSection(&m_mutex); }
};
使用Entrek Codesnitch软件调试和测试是否有内存泄漏等,报如下错误:
InitializeCriticalSection Error: lpCriticalSection (0x000387d4) points to an invalid
memory location (0x00018984) Mutex::Mutex in lockmutex.h, line 29
也许我所有的不眠之夜终于来到了我身边。但我不明白它到底在抱怨什么。有任何想法吗?