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

📄 thread_pool.h

📁 这是一个模拟电信计费的程序,非常详细,运用了线程池、消息队列和socket编程等技术。
💻 H
字号:
#ifndef __THREAD_POOL_H__#define __THREAD_POOL_H__#include <pthread.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>#include <unistd.h>#include <iostream>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/uio.h>#include <errno.h>#include <string.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>using std::cout;using std::endl;#define LISTENQ 10#define Q_ID 0x500#define ERR_REPORT() { cout << strerror(errno) << endl; exit(-1); }#define __DEBUGclass thread_pool{protected:		    int total;    int mqid;public:        thread_pool(int _i = 1, int key = Q_ID);        virtual ~thread_pool();        virtual void start(int port) = 0;public:	struct info{			char user_name[50];			time_t start_time;			time_t duration;			char IP[16];			info() { strcpy(IP,"127.0.0.1"); }		};	  struct _mesg{			long mtype;			char inf[sizeof(info)];		};};#endif

⌨️ 快捷键说明

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