replaced unused map with list
This commit is contained in:
parent
24c05cdf6a
commit
fd62105a9d
@ -22,21 +22,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "unordered_defs.h"
|
#include <list>
|
||||||
using std::queue;
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "ptmutex.h"
|
#include "ptmutex.h"
|
||||||
|
|
||||||
/// Store per-worker-thread data. Just an initialized timespec, and
|
|
||||||
/// used at the moment.
|
|
||||||
class WQTData {
|
|
||||||
public:
|
|
||||||
WQTData() {wstart.tv_sec = 0; wstart.tv_nsec = 0;}
|
|
||||||
struct timespec wstart;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A WorkQueue manages the synchronisation around a queue of work items,
|
* A WorkQueue manages the synchronisation around a queue of work items,
|
||||||
* where a number of client threads queue tasks and a number of worker
|
* where a number of client threads queue tasks and a number of worker
|
||||||
@ -94,7 +84,7 @@ public:
|
|||||||
m_name.c_str(), err));
|
m_name.c_str(), err));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_worker_threads.insert(pair<pthread_t, WQTData>(thr, WQTData()));
|
m_worker_threads.push_back(thr);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -213,11 +203,11 @@ public:
|
|||||||
// Perform the thread joins and compute overall status
|
// Perform the thread joins and compute overall status
|
||||||
// Workers return (void*)1 if ok
|
// Workers return (void*)1 if ok
|
||||||
void *statusall = (void*)1;
|
void *statusall = (void*)1;
|
||||||
STD_UNORDERED_MAP<pthread_t, WQTData>::iterator it;
|
std::list<pthread_t>::iterator it;
|
||||||
while (!m_worker_threads.empty()) {
|
while (!m_worker_threads.empty()) {
|
||||||
void *status;
|
void *status;
|
||||||
it = m_worker_threads.begin();
|
it = m_worker_threads.begin();
|
||||||
pthread_join(it->first, &status);
|
pthread_join(*it, &status);
|
||||||
if (status == (void *)0)
|
if (status == (void *)0)
|
||||||
statusall = status;
|
statusall = status;
|
||||||
m_worker_threads.erase(it);
|
m_worker_threads.erase(it);
|
||||||
@ -330,7 +320,7 @@ private:
|
|||||||
|
|
||||||
// Per-thread data. The data is not used currently, this could be
|
// Per-thread data. The data is not used currently, this could be
|
||||||
// a set<pthread_t>
|
// a set<pthread_t>
|
||||||
STD_UNORDERED_MAP<pthread_t, WQTData> m_worker_threads;
|
std::list<pthread_t> m_worker_threads;
|
||||||
|
|
||||||
// Synchronization
|
// Synchronization
|
||||||
queue<T> m_queue;
|
queue<T> m_queue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user