-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.cpp
More file actions
40 lines (32 loc) · 774 Bytes
/
Server.cpp
File metadata and controls
40 lines (32 loc) · 774 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: Server.cpp
* Author: mru
*
* Created on 27 de diciembre de 2011, 10:37
*/
#include <cstdlib>
#include "Task.cpp"
#include "Pool.cpp"
#include "SpecificWorker.cpp"
int const N_THREADS = 20;
int const N_TASK = 1000;
using namespace std;
int main(int argc, char** argv) {
//create some Task
Task<int> tasks[N_TASK];
//me gustaria no especializar a <typeDate>
Pool<int> pool;
for (int i=0;i<N_TASK; i++){
tasks[i].set_data(i);
//Push in the Pool
pool.push(tasks[i]);
}
//Create some workers
SpecificWorker<int> wk (pool);
Poco::Thread thread[N_THREADS];
for(int i=0;i<N_THREADS;i++)
thread[i].start(wk);
for(int i=0;i<N_THREADS; i++)
thread[i].join();
return 0;
}