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