So many changes. Broken.
[invirt/third/libt4.git] / lock_client.cc
index ca21d9d..4b26a91 100644 (file)
@@ -1,31 +1,31 @@
 // RPC stubs for clients to talk to lock_server, and cache the locks.
 
-#include "lock_client.h"
+#include "include/lock_client.h"
 #include <arpa/inet.h>
 
-void lock_state::wait(lock & mutex_lock) {
+void lock_client::lock_state::wait(lock & mutex_lock) {
     auto self = std::this_thread::get_id();
     c[self].wait(mutex_lock);
     c.erase(self);
 }
 
-void lock_state::signal() {
+void lock_client::lock_state::signal() {
     // signal anyone
     if (c.begin() != c.end())
         c.begin()->second.notify_one();
 }
 
-void lock_state::signal(thread::id who) {
+void lock_client::lock_state::signal(thread::id who) {
     if (c.count(who))
         c[who].notify_one();
 }
 
-lock_state & lock_client::get_lock_state(lock_protocol::lockid_t lid) {
+lock_client::lock_state & lock_client::get_lock_state(lock_protocol::lockid_t lid) {
     lock sl(lock_table_lock);
     return lock_table[lid]; // creates the lock if it doesn't already exist
 }
 
-lock_client::lock_client(string xdst, lock_release_user *_lu) : lu(_lu), next_xid(0) {
+lock_client::lock_client(string xdst) {
     rlock_port = std::uniform_int_distribution<in_port_t>(1024,32000+1024)(global->random_generator);
     id = "127.0.0.1:" + std::to_string(rlock_port);
     rlsrpc = std::make_unique<rpcs>(rlock_port);
@@ -54,8 +54,6 @@ void lock_client::releaser() {
             sl.unlock();
             int r;
             rsmc->call(lock_protocol::release, r, lid, id, st.xid);
-            if (lu)
-                lu->dorelease(lid);
             sl.lock();
         }
         st.state = lock_state::none;