|
a/src/utils/workqueue.h |
|
b/src/utils/workqueue.h |
|
... |
|
... |
47 |
* @param name for message printing
|
47 |
* @param name for message printing
|
48 |
* @param hi number of tasks on queue before clients blocks. Default 0
|
48 |
* @param hi number of tasks on queue before clients blocks. Default 0
|
49 |
* meaning no limit. hi == -1 means that the queue is disabled.
|
49 |
* meaning no limit. hi == -1 means that the queue is disabled.
|
50 |
* @param lo minimum count of tasks before worker starts. Default 1.
|
50 |
* @param lo minimum count of tasks before worker starts. Default 1.
|
51 |
*/
|
51 |
*/
|
52 |
WorkQueue(const string& name, size_t hi = 0, size_t lo = 1)
|
52 |
WorkQueue(const std::string& name, size_t hi = 0, size_t lo = 1)
|
53 |
: m_name(name), m_high(hi), m_low(lo),
|
53 |
: m_name(name), m_high(hi), m_low(lo),
|
54 |
m_workers_exited(0), m_clients_waiting(0), m_workers_waiting(0),
|
54 |
m_workers_exited(0), m_clients_waiting(0), m_workers_waiting(0),
|
55 |
m_tottasks(0), m_nowake(0), m_workersleeps(0), m_clientsleeps(0)
|
55 |
m_tottasks(0), m_nowake(0), m_workersleeps(0), m_clientsleeps(0)
|
56 |
{
|
56 |
{
|
57 |
m_ok = (pthread_cond_init(&m_ccond, 0) == 0) &&
|
57 |
m_ok = (pthread_cond_init(&m_ccond, 0) == 0) &&
|
|
... |
|
... |
307 |
return (newer.tv_sec - older.tv_sec) * 1000000000LL
|
307 |
return (newer.tv_sec - older.tv_sec) * 1000000000LL
|
308 |
+ newer.tv_nsec - older.tv_nsec;
|
308 |
+ newer.tv_nsec - older.tv_nsec;
|
309 |
}
|
309 |
}
|
310 |
|
310 |
|
311 |
// Configuration
|
311 |
// Configuration
|
312 |
string m_name;
|
312 |
std::string m_name;
|
313 |
size_t m_high;
|
313 |
size_t m_high;
|
314 |
size_t m_low;
|
314 |
size_t m_low;
|
315 |
|
315 |
|
316 |
// Status
|
316 |
// Status
|
317 |
// Worker threads having called exit
|
317 |
// Worker threads having called exit
|