summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-02-17 00:57:54 +0100
committerCarl Hetherington <cth@carlh.net>2022-02-17 00:57:54 +0100
commitc3ce1bf707fb5308f4b96cb96ed6e8d29335a319 (patch)
tree5dcf2fefc25e53201b5a3f98d41772b03f0051d4
parentfa85cc6352a2f25bdd1d4421c9490f9fca266e04 (diff)
Keep Waker around for longer so it works better (#2184).
-rw-r--r--src/lib/encode_server.cc3
-rw-r--r--src/lib/encode_server.h8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc
index 24ba5bc45..cd471d171 100644
--- a/src/lib/encode_server.cc
+++ b/src/lib/encode_server.cc
@@ -336,8 +336,7 @@ EncodeServer::handle (shared_ptr<Socket> socket)
{
boost::mutex::scoped_lock lock (_mutex);
- Waker waker;
- waker.nudge ();
+ _waker.nudge ();
/* Wait until the queue has gone down a bit */
while (_queue.size() >= _worker_threads.size() * 2 && !_terminate) {
diff --git a/src/lib/encode_server.h b/src/lib/encode_server.h
index 6e24a1984..0ca60f3f3 100644
--- a/src/lib/encode_server.h
+++ b/src/lib/encode_server.h
@@ -28,16 +28,17 @@
*/
-#include "server.h"
+#include "cross.h"
#include "exception_store.h"
-#include <boost/thread.hpp>
+#include "server.h"
#include <boost/asio.hpp>
+#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <string>
-class Socket;
class Log;
+class Socket;
/** @class EncodeServer
@@ -65,6 +66,7 @@ private:
boost::condition _empty_condition;
bool _verbose;
int _num_threads;
+ Waker _waker;
struct Broadcast {