|
a/src/utils/workqueue.h |
|
b/src/utils/workqueue.h |
|
... |
|
... |
60 |
* @param name for message printing
|
60 |
* @param name for message printing
|
61 |
* @param hi number of tasks on queue before clients blocks. Default 0
|
61 |
* @param hi number of tasks on queue before clients blocks. Default 0
|
62 |
* meaning no limit. hi == -1 means that the queue is disabled.
|
62 |
* meaning no limit. hi == -1 means that the queue is disabled.
|
63 |
* @param lo minimum count of tasks before worker starts. Default 1.
|
63 |
* @param lo minimum count of tasks before worker starts. Default 1.
|
64 |
*/
|
64 |
*/
|
65 |
WorkQueue(const string& name, int hi = 0, int lo = 1)
|
65 |
WorkQueue(const string& name, size_t hi = 0, size_t lo = 1)
|
66 |
: m_name(name), m_high(hi), m_low(lo),
|
66 |
: m_name(name), m_high(hi), m_low(lo),
|
67 |
m_workers_exited(0), m_clients_waiting(0), m_workers_waiting(0),
|
67 |
m_workers_exited(0), m_clients_waiting(0), m_workers_waiting(0),
|
68 |
m_tottasks(0), m_nowake(0), m_workersleeps(0), m_clientsleeps(0)
|
68 |
m_tottasks(0), m_nowake(0), m_workersleeps(0), m_clientsleeps(0)
|
69 |
{
|
69 |
{
|
70 |
m_ok = (m_high >= 0) && (pthread_cond_init(&m_ccond, 0) == 0) &&
|
70 |
m_ok = (pthread_cond_init(&m_ccond, 0) == 0) &&
|
71 |
(pthread_cond_init(&m_wcond, 0) == 0);
|
71 |
(pthread_cond_init(&m_wcond, 0) == 0);
|
72 |
}
|
72 |
}
|
73 |
|
73 |
|
74 |
~WorkQueue()
|
74 |
~WorkQueue()
|
75 |
{
|
75 |
{
|