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

📄 main.c

📁 通用 linux 线程池, 使用 C++ 编写, 具有良好的扩展性.
💻 C
字号:
#include "shared_ptr.h"#include "lock.h"#include <iostream>#include <pthread.h>#include <string>#include <unistd.h>#include "thread.h"#include "threadpool.h"#include "myjob.h"using namespace std;using namespace util;#include "mythread.h"#include "myjob.h"int main(){	shared_ptr<ThreadPool> mPool = shared_ptr<ThreadPool>(new ThreadPool(5));	shared_ptr<BaseJob> mJob = shared_ptr<BaseJob>(new MyJob);		string str;	while(1)	{		cout<<"please input add ? \n";		cin>>str;		if(str == "exit")			break;		else if(str == "stop")		{			mPool->stop();						cout<<"the pool is destroying.....\n";		}		else if(str == "add")		{			for(int i = 0; i< 30; i++)				mPool->addJob(mJob);		}		else			cout<<"bad command .. \n";	}	return 0;}

⌨️ 快捷键说明

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