-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
37 lines (37 loc) · 861 Bytes
/
Copy pathtest.cpp
File metadata and controls
37 lines (37 loc) · 861 Bytes
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
#include <iostream>
#include <functional>
#include <Windows.h>
//#include "priorityThreadPool.h"
#include "ptpl2.h"
#include "timeouttable.h"
using namespace std;
//using namespace ptpl;
int test1() {
Sleep(2000);
cout << "helloworld" << endl;
return 7;
}
void test2(int a) {
Sleep(2000);
cout << "prioritytask" <<a<< endl;
}
int main() {
/*AutoSuitPool p(5,2,1);
cout << "运行中的线程数量:" << p.GetRunningThread() << endl;
for(int i=0;i<10;i++)
p.push(test1);
Sleep(50);
cout << "运行中的线程数量:" << p.GetRunningThread() << endl;
Sleep(15000);
cout << "运行中的线程数量:" << p.GetRunningThread() << endl;
Sleep(50);
p.push(test1);
p.push(test1);
Sleep(50);
cout << "运行中的线程数量:" << p.GetRunningThread() << endl;*/
PriorityThreadPool ptp(2);
ptp.push(1, test1);
ptp.push(1, test1);
ptp.push(2, test2,6);
ptp.push(1, test1);
}