From: Arvin Schnell Date: Fri, 20 Jul 2012 12:17:36 +0000 (+0200) Subject: - work on dbus interface X-Git-Tag: v0.1.3~202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b440e85b1de2f96d6781b3b9beca540773ddcd0f;p=thirdparty%2Fsnapper.git - work on dbus interface --- diff --git a/server/Client.cc b/server/Client.cc index 9f29c4d3..6a4ba94c 100644 --- a/server/Client.cc +++ b/server/Client.cc @@ -35,13 +35,13 @@ Client::Client(const string& name) : name(name) { c = new boost::condition_variable; - m = new boost::mutex; t = NULL; } Client::~Client() { + // TODO } @@ -99,7 +99,7 @@ Client::add_task(DBus::Connection& conn, DBus::Message& msg) if (!t) t = new boost::thread(boost::bind(&Client::worker, this)); - boost::unique_lock l(*m); + boost::unique_lock l(m); tasks.push(Task(conn, msg)); l.unlock(); @@ -107,12 +107,13 @@ Client::add_task(DBus::Connection& conn, DBus::Message& msg) } + void Client::worker() { while (true) { - boost::unique_lock l(*m); + boost::unique_lock l(m); while (tasks.empty()) c->wait(l); @@ -143,7 +144,7 @@ Clients::add(const string& name) { assert(find(name) == entries.end()); - entries.push_back(Client(name)); + entries.emplace_back(name); return --entries.end(); } diff --git a/server/Client.h b/server/Client.h index b85cdf4f..2f171a10 100644 --- a/server/Client.h +++ b/server/Client.h @@ -89,7 +89,7 @@ public: }; -class Client : public Commands +class Client : public Commands, boost::noncopyable { public: @@ -121,7 +121,7 @@ public: }; boost::condition_variable* c; - boost::mutex* m; + boost::mutex m; boost::thread* t; queue tasks;