实在不明白了,老说这个raii有问题
- C/C++ code
那里有问题啊class CMyMutex{HANDLE hMutex;public:CMyMutex(){hMutex=::CreateMutex(NULL,true,NULL); //第二个参数,创建线程拥有互斥体};~CMyMutex(){::ReleaseMutex(hMutex);::CloseHandle(hMutex);}unsigned int MyThread1(void* ){//other codeCMyMutex mutex;/*dosomehing*/return 0;}unsigned int MyThread2(void* ){//other codeCMyMutex mutex;/*dosomehing*/return 0;}[解决办法]