aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-16 08:43:57 +0100
committerMax Kellermann <max@duempel.org>2014-01-16 08:43:57 +0100
commit028fd268b89163c9c6e938794064339f0989d6a0 (patch)
tree5c8a834384362629074a5378beb532b508cf3a21 /src/db/upnp
parent876a095166de3a834007e637b9f845ffbc5a275a (diff)
downloadmpd-028fd268b89163c9c6e938794064339f0989d6a0.tar.gz
mpd-028fd268b89163c9c6e938794064339f0989d6a0.tar.xz
mpd-028fd268b89163c9c6e938794064339f0989d6a0.zip
db/upnp/WorkQueue: simplify start()
Diffstat (limited to 'src/db/upnp')
-rw-r--r--src/db/upnp/WorkQueue.hxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/db/upnp/WorkQueue.hxx b/src/db/upnp/WorkQueue.hxx
index 723254251..274b85995 100644
--- a/src/db/upnp/WorkQueue.hxx
+++ b/src/db/upnp/WorkQueue.hxx
@@ -90,7 +90,7 @@ public:
* @param arg initial parameter to thread function.
* @return true if ok.
*/
- bool start(int nworkers, void *(*workproc)(void *), void *arg)
+ bool start(unsigned nworkers, void *(*workproc)(void *), void *arg)
{
const ScopeLock protect(mutex);
@@ -99,11 +99,12 @@ public:
assert(n_threads == 0);
assert(threads == nullptr);
- threads = new pthread_t[nworkers];
+ n_threads = nworkers;
+ threads = new pthread_t[n_threads];
- for (int i = 0; i < nworkers; i++) {
+ for (unsigned i = 0; i < nworkers; i++) {
int err;
- if ((err = pthread_create(&threads[n_threads++], 0, workproc, arg))) {
+ if ((err = pthread_create(&threads[i], 0, workproc, arg))) {
LOGERR(("WorkQueue:%s: pthread_create failed, err %d\n",
name.c_str(), err));
return false;