thread_pool.cc

来自「这是一个模拟电信计费的程序,非常详细,运用了线程池、消息队列和socket编程等」· CC 代码 · 共 27 行

CC
27
字号
#include "thread_pool.h"using namespace std;thread_pool::thread_pool(int _i, int key) : total(_i) {	#ifdef __DEBUG	cout << " Create thread pool " << endl; 	#endif	//create ipc queue to send/receive messages		if((mqid = msgget(key,0))<0) 		{    	mqid = msgget(key, IPC_CREAT | IPC_EXCL | 0600);    	if (mqid < 0)    	{            ERR_REPORT();       	}    }}thread_pool::~thread_pool() { 	#ifdef __DEBUG	cout << " Thread pool canceled. " << endl;	#endif	msgctl(mqid,IPC_RMID,0);}

⌨️ 快捷键说明

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