mutex.cpp

来自「图象处理」· C++ 代码 · 共 30 行

CPP
30
字号
// Mutex.cpp: implementation of the CMutex class.
//
//////////////////////////////////////////////////////////////////////

#include "Mutex.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMutex::CMutex()
{
	m_hMutex = CreateMutex(NULL, FALSE, NULL);
}

CMutex::~CMutex()
{
	CloseHandle(m_hMutex);
}

void CMutex::LockMutex()
{
	WaitForSingleObject(m_hMutex, INFINITE);
}

void CMutex::UnlockMutex()
{
	ReleaseMutex(m_hMutex);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?