source: Sophya/trunk/ArchTOIPipe/Kernel/toimanager.cc@ 1686

Last change on this file since 1686 was 1684, checked in by aubourg, 24 years ago

bug getMaxIn

File size: 967 bytes
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
10TOIManager::TOIManager() {
11 reqBegin = 0;
12 reqEnd = MAXINT;
13}
14
15TOIManager* TOIManager::instance = NULL;
16
17TOIManager* TOIManager::getManager() {
18 if (instance == NULL) instance = new TOIManager();
19 return instance;
20}
21
22void TOIManager::setRequestedSample(int begin, int end) {
23 reqBegin = begin;
24 reqEnd = end;
25}
26
27int TOIManager::getRequestedBegin() {
28 return reqBegin;
29}
30
31int TOIManager::getRequestedEnd() {
32 return reqEnd;
33}
34
35void TOIManager::addThread(pthread_t* t) {
36 // cout << "adding thread " << t << endl;
37 threads.push_back(t);
38}
39
40void 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.