⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 condvar.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
//////////////////////////////////////////////////////////////////////// // CondVar.h // // by Reiot// ////////////////////////////////////////////////////////////////////////// represents Conditional Variable ( Thread Synchronization Primitive )////////////////////////////////////////////////////////////////////////#ifndef __COND_VAR_H__#define __COND_VAR_H__//////////////////////////////////////////////////// include files//////////////////////////////////////////////////#include "CondVarAttr.h"#include "Exception.h"#include "Mutex.h"#include "pthreadAPI.h"////////////////////////////////////////////////////////////////////////// class CondVar;////////////////////////////////////////////////////////////////////////class CondVar {//////////////////////////////////////////////////// constructor/destructor//////////////////////////////////////////////////public :		// constructor	CondVar ( CondVarAttr * attr = NULL ) throw ( Error );		// destructor	virtual ~CondVar () throw ( CondVarException , Error );	//////////////////////////////////////////////////// methods//////////////////////////////////////////////////public :		// wake up a waiting thread	void signal () throw ( Error );		// waiting until somebody wake up me	void wait ( Mutex & mutex ) throw ( Error );		//	// waiting until somebody wake up me or specified time elapsed	//	// *NOTES* 	// CondVarException means Timeout	//	void timedwait ( Mutex & mutex , const struct timespec * timeout ) 		throw ( CondVarException , InterruptedException , Error );		// wake up all waiting threads	void broadcast () throw ( Error );		// get raw conditional-variable object	pthread_cond_t * getCondVar () throw () { return &m_Cond; }//////////////////////////////////////////////////// attributes//////////////////////////////////////////////////private :		// raw conditional-variable object	pthread_cond_t m_Cond;	};#endif

⌨️ 快捷键说明

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