projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use boost::signals2; fix bugs with x-thread signalling.
[dcpomatic.git]
/
src
/
lib
/
server.cc
diff --git
a/src/lib/server.cc
b/src/lib/server.cc
index 10f64b48250ee044e87128d45b7c5db8fe85e3c3..c80527567cbdd58a7c13a55a5e6f0805c37e67d6 100644
(file)
--- a/
src/lib/server.cc
+++ b/
src/lib/server.cc
@@
-36,8
+36,16
@@
#include "config.h"
#include "subtitle.h"
#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.
/** 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) {
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);
}
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)));
}
_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 ());
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) {
/* Wait until the queue has gone down a bit */
while (int (_queue.size()) >= num_threads * 2) {