📄 threadpool.h
字号:
//////////////////////////////////////////////////////////////////////// // ThreadPool.h // // by Reiot// //////////////////////////////////////////////////////////////////////#ifndef __THREAD_POOL_H__#define __THREAD_POOL_H__//////////////////////////////////////////////////// include files//////////////////////////////////////////////////#include <list>#include "Types.h"#include "Exception.h"#include "Thread.h"#include "Mutex.h"//////////////////////////////////////////////////// forward declaration//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class ThreadPool//// 静饭靛 按眉甸狼 拿泛记 努贰胶捞促. 辑滚 辆丰矫 劝悼吝牢 葛电 静饭靛甸阑// 吝窜矫懦 锭, 静饭靛钱 按眉狼 Stop皋筋靛甫 荤侩窍搁 等促. 郴何利栏肺// 矫弊澄捞唱 牡浇饭捞记捞 荤侩瞪 傈噶捞促. 弊繁单, 酒流篮 磊丰啊 绝绢辑// 备泅阑 给窍绊 乐促. ^^;////////////////////////////////////////////////////////////////////////class ThreadPool {//////////////////////////////////////////////////// constructor/destructor//////////////////////////////////////////////////public: // constructor ThreadPool() throw(); // destructor // 器窃窍绊 乐绰 葛电 静饭靛 按眉甫 昏力秦具 茄促. virtual ~ThreadPool() throw(); //////////////////////////////////////////////////// methods//////////////////////////////////////////////////public: // 静饭靛钱救俊 殿废等 静饭靛甸阑 RUNNING 惑怕肺 父电促. void start() throw(Error); // 静饭靛钱救俊 殿废等 葛电 静饭靛狼 角青阑 吝窜矫挪促. //(捞绰 singal 趣篮 cancellation 栏肺 备泅秦具 窍摆促.) void stop() throw(Error); // 静饭靛钱俊 静饭靛 按眉甫 殿废茄促. void addThread(Thread* thread) throw(Error); // 静饭靛钱俊辑 漂沥 静饭靛 按眉甫 昏力茄促. void deleteThread(TID tid) throw(NoSuchElementException, Error); // 静饭靛钱俊辑 漂沥 静饭靛 按眉甫 茫酒辑 府畔茄促. Thread* getThread(TID tid) throw(NoSuchElementException, Error);//#ifdef __NO_COMBAT__ list<Thread*> getThreads(){ return m_Threads; } // 辫版籍//#endif//////////////////////////////////////////////////// attributes//////////////////////////////////////////////////private: // // 静饭靛 按眉狼 器牢磐俊 措茄 府胶飘 // 角力肺绰 静饭靛 努贰胶狼 窍困 努贰胶啊 甸绢啊霸 等促. // 老馆利栏肺 鞍篮 辆幅狼 静饭靛甸捞 殿废等促. // // ex> PlayerThreadPool - PlayerThread // NPCThreadPool - NPCThread // MobThreadPool - MobThread // list<Thread*> m_Threads; // mutex for list operation(add, delete, get ...) mutable Mutex m_Mutex;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -