-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
45 lines (41 loc) · 1.02 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include "ThreadPool/NJThreadPool.h"
using namespace NJ::Libs;
using namespace std;
class Job : public IRunnable {
public:
Job(){}
void run() {
cout<<"Job is Runing!"<<endl;
}
};
int main() {
NJThreadPool pool(10);
cout<<"pool start"<<endl;
std::shared_ptr<IRunnable> job1(new Job);
std::shared_ptr<IRunnable> job2(new Job);
std::shared_ptr<IRunnable> job3(new Job);
std::shared_ptr<IRunnable> job4(new Job);
std::shared_ptr<IRunnable> job5(new Job);
std::shared_ptr<IRunnable> job6(new Job);
int y;
//cin>>y;
cout<<pool.submitJob(job1)<<endl;
//cin>>y;
cout<<pool.submitJob(job2)<<endl;
//cin>>y;
cout<<pool.submitJob(job3)<<endl;
//cin>>y;
cout<<pool.submitJob(job4)<<endl;
//cin>>y;
cout<<pool.submitJob(job5)<<endl;
//cin>>y;
cout<<pool.submitJob(job6)<<endl;
//cin>>y;
for(int i=0;i<11;i++) {
cout<<pool.submitJob(job1)<<endl;
}
int x;
cin>>x;
return 0;
}