]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- work on dbus interface
authorArvin Schnell <aschnell@suse.de>
Fri, 20 Jul 2012 12:17:36 +0000 (14:17 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 20 Jul 2012 12:17:36 +0000 (14:17 +0200)
server/Client.cc
server/Client.h

index 9f29c4d353c1ffed8e5c586bf62310dfc5394a76..6a4ba94c4ecac56a7655b2b4aeff16149eed597e 100644 (file)
@@ -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<boost::mutex> l(*m);
+    boost::unique_lock<boost::mutex> 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<boost::mutex> l(*m);
+        boost::unique_lock<boost::mutex> 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();
 }
 
index b85cdf4f912623e1936d3d24fff613588f44a8da..2f171a105c2e0cc9e43613efe062a9069b4e9716 100644 (file)
@@ -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<Task> tasks;