diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-26 11:04:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-26 11:04:02 +0100 |
| commit | 02f028d271677b3b3669b5cdfda1597108a34b80 (patch) | |
| tree | 76618364e855af0e31bc88c44f8357da62d8c5f5 /src/lib/server.cc | |
| parent | ee8f7f7edb1da818f60dfd2da11ca458aad0dc35 (diff) | |
Use full/empty conditions rather than just a single condition for the server and encoder.
Diffstat (limited to 'src/lib/server.cc')
| -rw-r--r-- | src/lib/server.cc | 8 |
1 files changed, 4 insertions, 4 deletions
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> 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 (); } } |
