📄 main.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 + -