From 02f028d271677b3b3669b5cdfda1597108a34b80 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 Jun 2014 11:04:02 +0100 Subject: Use full/empty conditions rather than just a single condition for the server and encoder. --- src/lib/server.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/server.cc') diff --git a/src/lib/server.cc b/src/lib/server.cc index ed7fb6145..7450fd12e 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -118,7 +118,7 @@ Server::worker_thread () while (1) { boost::mutex::scoped_lock lock (_worker_mutex); while (_queue.empty ()) { - _worker_condition.wait (lock); + _empty_condition.wait (lock); } shared_ptr socket = _queue.front (); @@ -169,7 +169,7 @@ Server::worker_thread () LOG_GENERAL_NC (message.str ()); } - _worker_condition.notify_all (); + _full_condition.notify_all (); } } @@ -202,11 +202,11 @@ Server::run (int num_threads) /* Wait until the queue has gone down a bit */ while (int (_queue.size()) >= num_threads * 2) { - _worker_condition.wait (lock); + _full_condition.wait (lock); } _queue.push_back (socket); - _worker_condition.notify_all (); + _empty_condition.notify_all (); } } -- cgit v1.2.3