_synchop.h

来自「http代理程序」· C头文件 代码 · 共 48 行

H
48
字号


/************************************
  REVISION LOG ENTRY
  Revision By: Alex Turc ( alex_turc@hotmail.com )
  Revised on 6/9/00 12:15:31 AM
  Comments: Synchronization operations
 ************************************/

#ifndef ___synchop_h__
#define ___synchop_h__

namespace extension
{

/*
Generic lock. Template argument must have Lock/Unlock methods
*/
template< class T >
class generic_lock
{
public:

	// Locks the object
	generic_lock( T& t ) :
		m_refT( t )
	{
		m_refT.lock();
	}

	// Unlocks the object
	virtual ~generic_lock()
	{
		m_refT.unlock();
	}

private:

	T& m_refT;

	// Disable some operations
	generic_lock( const T& );
	generic_lock& operator=( const T& );
};

} // Namespace extension

#endif // ___synchop_h__

⌨️ 快捷键说明

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