mutexguard.h
来自「Socketlib: 一个轻量级的C++ 封装Socket C API 网络编程」· C头文件 代码 · 共 38 行
H
38 行
#pragma once
namespace SYNC
{
template <class TMutex>
class CMutexGuard
{
private:
//= Prevent assignment and initialization.
// Disallow copying and assignment.
CMutexGuard(const CMutexGuard &);
void operator= (const CMutexGuard &);
public:
CMutexGuard(TMutex & mtx)
: m_mtx(mtx)
{
m_mtx.Lock();
};
CMutexGuard(TMutex & mtx, DWORD nTimeOut)
: m_mtx(mtx)
{
m_mtx.Lock(nTimeOut);
};
~CMutexGuard(void)
{
m_mtx.UnLock();
};
private:
TMutex &m_mtx;
};
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?