|
a/src/utils/workqueue.h |
|
b/src/utils/workqueue.h |
|
... |
|
... |
20 |
#include <pthread.h>
|
20 |
#include <pthread.h>
|
21 |
#include <time.h>
|
21 |
#include <time.h>
|
22 |
|
22 |
|
23 |
#include <string>
|
23 |
#include <string>
|
24 |
#include <queue>
|
24 |
#include <queue>
|
25 |
#include <tr1/unordered_map>
|
25 |
#include "unordered_defs.h"
|
26 |
#include <tr1/unordered_set>
|
|
|
27 |
using std::tr1::unordered_map;
|
|
|
28 |
using std::tr1::unordered_set;
|
|
|
29 |
using std::queue;
|
26 |
using std::queue;
|
30 |
using std::string;
|
27 |
using std::string;
|
31 |
|
28 |
|
32 |
#include "debuglog.h"
|
29 |
#include "debuglog.h"
|
33 |
#include "ptmutex.h"
|
30 |
#include "ptmutex.h"
|
|
... |
|
... |
214 |
m_name.c_str(), m_tottasks, m_nowake, m_workersleeps,
|
211 |
m_name.c_str(), m_tottasks, m_nowake, m_workersleeps,
|
215 |
m_clientsleeps));
|
212 |
m_clientsleeps));
|
216 |
// Perform the thread joins and compute overall status
|
213 |
// Perform the thread joins and compute overall status
|
217 |
// Workers return (void*)1 if ok
|
214 |
// Workers return (void*)1 if ok
|
218 |
void *statusall = (void*)1;
|
215 |
void *statusall = (void*)1;
|
219 |
unordered_map<pthread_t, WQTData>::iterator it;
|
216 |
STD_UNORDERED_MAP<pthread_t, WQTData>::iterator it;
|
220 |
while (!m_worker_threads.empty()) {
|
217 |
while (!m_worker_threads.empty()) {
|
221 |
void *status;
|
218 |
void *status;
|
222 |
it = m_worker_threads.begin();
|
219 |
it = m_worker_threads.begin();
|
223 |
pthread_join(it->first, &status);
|
220 |
pthread_join(it->first, &status);
|
224 |
if (status == (void *)0)
|
221 |
if (status == (void *)0)
|
|
... |
|
... |
331 |
unsigned int m_workers_exited;
|
328 |
unsigned int m_workers_exited;
|
332 |
bool m_ok;
|
329 |
bool m_ok;
|
333 |
|
330 |
|
334 |
// Per-thread data. The data is not used currently, this could be
|
331 |
// Per-thread data. The data is not used currently, this could be
|
335 |
// a set<pthread_t>
|
332 |
// a set<pthread_t>
|
336 |
unordered_map<pthread_t, WQTData> m_worker_threads;
|
333 |
STD_UNORDERED_MAP<pthread_t, WQTData> m_worker_threads;
|
337 |
|
334 |
|
338 |
// Synchronization
|
335 |
// Synchronization
|
339 |
queue<T> m_queue;
|
336 |
queue<T> m_queue;
|
340 |
pthread_cond_t m_ccond;
|
337 |
pthread_cond_t m_ccond;
|
341 |
pthread_cond_t m_wcond;
|
338 |
pthread_cond_t m_wcond;
|