forked from foshougua/network-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (30 loc) · 788 Bytes
/
main.cpp
File metadata and controls
40 lines (30 loc) · 788 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
38
39
/*************************************************************************
> File Name: main.cpp
> Author:
> Mail:
> Created Time: 2017年05月09日 星期二 09时47分21秒
************************************************************************/
#include "MyThreadPool.h"
#include "MyTask.h"
#include <iostream>
#include<unistd.h>
#include<vector>
using namespace std;
int main()
{
MyThreadPool mythreadPool(10);
string filename = "./MyThreadPool.cpp";
File file(filename);
int blockNum = file.getBlockNum();
vector<MyTask*> vec;
for(int i = 0; i < blockNum; i++)
{
MyTask *block = new MyTask(i + 1, &file);
vec.push_back(block);
}
for (int i = 0; i < blockNum; i++)
{
mythreadPool.AddTask(vec[i], 0);
}
sleep(10);
}