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

📄 threadattr.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
////////////////////////////////////////////////////////////////////////// ThreadAttr.h//// by Reiot////////////////////////////////////////////////////////////////////////#ifndef __THREAD_ATTR_H__#define __THREAD_ATTR_H__//////////////////////////////////////////////////// include files//////////////////////////////////////////////////#include <pthread.h>#include "Types.h"#include "Exception.h"//////////////////////////////////////////////////// forward declaration//////////////////////////////////////////////////class ThreadAttrException;////////////////////////////////////////////////////////////////////////// class ThreadAttr;//// Thread-Attribute 努贰胶绰 悼老茄 加己(attribute)狼 Thread 努贰胶甫 // 咯矾 俺 积己且 鞘夸啊 乐阑 锭 pthread_create()狼 颇扼固磐肺 荤侩等促. // 溜 窍唱狼 Thread-Attribute 按眉父 积己秦初栏搁 等促绰 舵捞促.// (贾扼府胶 静饭靛俊 乐绢辑 积己且锭付促 thread-flag 甫 瘤沥沁带// 扁撅阑 登混妨 焊扼~)//// 弊繁单, 角力肺绰 肋 静捞瘤 臼阑 淀 窍促. 恐衬窍搁 啊厘 蜡侩窍霸// 荤侩瞪 setstacksize()啊 力傍登瘤 臼栏哥, detach 绰 pthread_detach()// 肺档 面盒窍扁 锭巩捞促.////////////////////////////////////////////////////////////////////////class ThreadAttr {//////////////////////////////////////////////////// constructor / destructor//////////////////////////////////////////////////public :		// constructor	ThreadAttr () throw ( Error );	// destructor	~ThreadAttr () throw ( Error );	//////////////////////////////////////////////////// public methods//////////////////////////////////////////////////public :		//	// return thread-attribute object	//	// *CAUTION* 	//	// do not return pthread_attr_t value !!	// use pthread_attr_t pointer instead.	// (pthread_attr_t 俊 措秦 assignment 啊 瘤盔登瘤 臼阑 啊瓷己 乐澜)	//	pthread_attr_t * getAttr () throw () { return &attr; }	// is thread attribute detached state?	bool isDetached () const throw ( Error ) { return getDetachState() == PTHREAD_CREATE_DETACHED; }		// set thread attribute detached state	void setDetached () throw ( Error ) { setDetachState(PTHREAD_CREATE_DETACHED); }	// is thread attribute joinable state?	bool isJoinable () const throw ( Error ) { return getDetachState() == PTHREAD_CREATE_JOINABLE; }		// set thread attribute joinable state	void setJoinable () throw ( Error ) { setDetachState(PTHREAD_CREATE_JOINABLE); }//////////////////////////////////////////////////// protected methods//////////////////////////////////////////////////protected :	// get thread attribute's state	int getDetachState () const throw ( Error );	// set thread attribute's state	void setDetachState ( int state ) throw ( Error );//////////////////////////////////////////////////// attributes//////////////////////////////////////////////////private :		// thread attribute	pthread_attr_t attr;};#endif

⌨️ 快捷键说明

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