Line | |
---|
1 | #include "toimanager.h"
|
---|
2 | #include <limits.h>
|
---|
3 | #include <pthread.h>
|
---|
4 | #include <iostream.h>
|
---|
5 |
|
---|
6 | #ifndef MAXINT
|
---|
7 | #define MAXINT 2147483647
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | TOIManager::TOIManager() {
|
---|
11 | reqBegin = 0;
|
---|
12 | reqEnd = MAXINT;
|
---|
13 | }
|
---|
14 |
|
---|
15 | TOIManager* TOIManager::instance = NULL;
|
---|
16 |
|
---|
17 | TOIManager* TOIManager::getManager() {
|
---|
18 | if (instance == NULL) instance = new TOIManager();
|
---|
19 | return instance;
|
---|
20 | }
|
---|
21 |
|
---|
22 | void TOIManager::setRequestedSample(int begin, int end) {
|
---|
23 | reqBegin = begin;
|
---|
24 | reqEnd = end;
|
---|
25 | }
|
---|
26 |
|
---|
27 | int TOIManager::getRequestedBegin() {
|
---|
28 | return reqBegin;
|
---|
29 | }
|
---|
30 |
|
---|
31 | int TOIManager::getRequestedEnd() {
|
---|
32 | return reqEnd;
|
---|
33 | }
|
---|
34 |
|
---|
35 | void TOIManager::addThread(pthread_t* t) {
|
---|
36 | // cout << "adding thread " << t << endl;
|
---|
37 | threads.push_back(t);
|
---|
38 | }
|
---|
39 |
|
---|
40 | void TOIManager::joinAll() {
|
---|
41 | for (vector<pthread_t*>::iterator i = threads.begin();
|
---|
42 | i != threads.end(); i++) {
|
---|
43 | pthread_t* pth = *i;
|
---|
44 | cout << "joining thread " << pth << endl;
|
---|
45 | pthread_join(*pth, NULL);
|
---|
46 | cout << "thread joined " << pth << endl;
|
---|
47 | }
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.