From 678524ad2109853be9ecc682f2ad7017794c6222 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 23 Jan 2017 19:25:30 +0100 Subject: [PATCH] lib/upnp/WorkQueue: fix race condition With "ok==false", newly created threads may quit instantly. --- src/lib/upnp/WorkQueue.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/upnp/WorkQueue.hxx b/src/lib/upnp/WorkQueue.hxx index 1144634f0..b503e9956 100644 --- a/src/lib/upnp/WorkQueue.hxx +++ b/src/lib/upnp/WorkQueue.hxx @@ -97,6 +97,7 @@ public: assert(n_threads == 0); assert(threads == nullptr); + ok = true; n_threads = nworkers; threads = new pthread_t[n_threads]; @@ -109,7 +110,6 @@ public: } } - ok = true; return true; }