db/upnp/WorkQueue: remove unused attributes "high", "low"
This commit is contained in:
@@ -48,8 +48,6 @@ template <class T>
|
|||||||
class WorkQueue {
|
class WorkQueue {
|
||||||
// Configuration
|
// Configuration
|
||||||
const std::string name;
|
const std::string name;
|
||||||
const size_t high;
|
|
||||||
const size_t low;
|
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
// Worker threads having called exit
|
// Worker threads having called exit
|
||||||
@@ -72,8 +70,8 @@ public:
|
|||||||
* meaning no limit. hi == -1 means that the queue is disabled.
|
* meaning no limit. hi == -1 means that the queue is disabled.
|
||||||
* @param lo minimum count of tasks before worker starts. Default 1.
|
* @param lo minimum count of tasks before worker starts. Default 1.
|
||||||
*/
|
*/
|
||||||
WorkQueue(const char *_name, size_t hi = 0, size_t lo = 1)
|
WorkQueue(const char *_name)
|
||||||
:name(_name), high(hi), low(lo),
|
:name(_name),
|
||||||
n_workers_exited(0),
|
n_workers_exited(0),
|
||||||
ok(false),
|
ok(false),
|
||||||
n_threads(0), threads(nullptr)
|
n_threads(0), threads(nullptr)
|
||||||
@@ -124,13 +122,6 @@ public:
|
|||||||
{
|
{
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
|
|
||||||
while (ok && high > 0 && queue.size() >= high) {
|
|
||||||
// Keep the order: we test ok AFTER the sleep...
|
|
||||||
client_cond.wait(mutex);
|
|
||||||
if (!ok)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
queue.push(t);
|
queue.push(t);
|
||||||
|
|
||||||
// Just wake one worker, there is only one new task.
|
// Just wake one worker, there is only one new task.
|
||||||
@@ -180,9 +171,7 @@ public:
|
|||||||
if (!ok)
|
if (!ok)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (ok && queue.size() < low) {
|
while (queue.empty()) {
|
||||||
if (queue.empty())
|
|
||||||
client_cond.broadcast();
|
|
||||||
worker_cond.wait(mutex);
|
worker_cond.wait(mutex);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return false;
|
return false;
|
||||||
@@ -190,9 +179,6 @@ public:
|
|||||||
|
|
||||||
tp = queue.front();
|
tp = queue.front();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
|
|
||||||
// No reason to wake up more than one client thread
|
|
||||||
client_cond.signal();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user