summaryrefslogtreecommitdiff
path: root/src/lib/server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-24 22:13:53 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-24 22:13:53 +0100
commit63ea6b6c5ee64f8ee067c2b488d004b6dfe363e0 (patch)
treed248762556466fd076cfd20f2e6aa1d5d9544184 /src/lib/server.cc
parent977b36672892b14de4ecb68e98415c64946e8a93 (diff)
Use boost::signals2; fix bugs with x-thread signalling.
Diffstat (limited to 'src/lib/server.cc')
-rw-r--r--src/lib/server.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 10f64b482..c80527567 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -36,8 +36,16 @@
#include "config.h"
#include "subtitle.h"
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::multimap;
+using std::vector;
+using std::cerr;
+using boost::shared_ptr;
+using boost::algorithm::is_any_of;
+using boost::algorithm::split;
+using boost::thread;
+using boost::bind;
/** Create a server description from a string of metadata returned from as_metadata().
* @param v Metadata.
@@ -132,7 +140,7 @@ void
Server::worker_thread ()
{
while (1) {
- mutex::scoped_lock lock (_worker_mutex);
+ boost::mutex::scoped_lock lock (_worker_mutex);
while (_queue.empty ()) {
_worker_condition.wait (lock);
}
@@ -176,13 +184,13 @@ Server::run (int num_threads)
_worker_threads.push_back (new thread (bind (&Server::worker_thread, this)));
}
- asio::io_service io_service;
- asio::ip::tcp::acceptor acceptor (io_service, asio::ip::tcp::endpoint (asio::ip::tcp::v4(), Config::instance()->server_port ()));
+ boost::asio::io_service io_service;
+ boost::asio::ip::tcp::acceptor acceptor (io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), Config::instance()->server_port ()));
while (1) {
shared_ptr<Socket> socket (new Socket);
acceptor.accept (socket->socket ());
- mutex::scoped_lock lock (_worker_mutex);
+ boost::mutex::scoped_lock lock (_worker_mutex);
/* Wait until the queue has gone down a bit */
while (int (_queue.size()) >= num_threads * 2) {