Cleanups
[invirt/third/libt4.git] / lock_server.cc
index f5a1fc4..a82231e 100644 (file)
@@ -2,7 +2,6 @@
 
 #include "lock_server.h"
 #include <sstream>
 
 #include "lock_server.h"
 #include <sstream>
-#include <stdio.h>
 #include <unistd.h>
 #include <arpa/inet.h>
 #include "lang/verify.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 #include "lang/verify.h"
@@ -32,12 +31,6 @@ lock_state& lock_state::operator=(const lock_state& o) {
     return *this;
 }
 
     return *this;
 }
 
-template <class A, class B>
-ostringstream & operator<<(ostringstream &o, const pair<A,B> &d) {
-    o << "<" << d.first << "," << d.second << ">";
-    return o;
-}
-
 marshall & operator<<(marshall &m, const lock_state &d) {
        return m << d.held << d.held_by << d.wanted_by;
 }
 marshall & operator<<(marshall &m, const lock_state &d) {
        return m << d.held << d.held_by << d.wanted_by;
 }
@@ -59,7 +52,7 @@ lock_server::lock_server(class rsm *_rsm) : rsm (_rsm) {
     rsm->set_state_transfer(this);
 }
 
     rsm->set_state_transfer(this);
 }
 
-void lock_server::revoker() {
+void lock_server::revoker() [[noreturn]] {
     while (1) {
         lock_protocol::lockid_t lid;
         revoke_fifo.deq(&lid);
     while (1) {
         lock_protocol::lockid_t lid;
         revoke_fifo.deq(&lid);
@@ -87,7 +80,7 @@ void lock_server::revoker() {
     }
 }
 
     }
 }
 
-void lock_server::retryer() {
+void lock_server::retryer() [[noreturn]] {
     while (1) {
         lock_protocol::lockid_t lid;
         retry_fifo.deq(&lid);
     while (1) {
         lock_protocol::lockid_t lid;
         retry_fifo.deq(&lid);
@@ -119,7 +112,7 @@ void lock_server::retryer() {
     }
 }
 
     }
 }
 
-int lock_server::acquire(int &r, lock_protocol::lockid_t lid, string id, lock_protocol::xid_t xid) {
+int lock_server::acquire(int &, lock_protocol::lockid_t lid, string id, lock_protocol::xid_t xid) {
     LOG_FUNC_ENTER_SERVER;
     holder h = holder(id, xid);
     lock_state &st = get_lock_state(lid);
     LOG_FUNC_ENTER_SERVER;
     holder h = holder(id, xid);
     lock_state &st = get_lock_state(lid);
@@ -168,7 +161,7 @@ int lock_server::acquire(int &r, lock_protocol::lockid_t lid, string id, lock_pr
     if (!found)
         st.wanted_by.push_back(h);
 
     if (!found)
         st.wanted_by.push_back(h);
 
-    LOG("wanted_by=" << JOIN(st.wanted_by.begin(), st.wanted_by.end(), " "));
+    LOG("wanted_by=" << make_iterator_pair(st.wanted_by.begin(), st.wanted_by.end()));
 
     // send revoke if we're first in line
     if (st.wanted_by.front() == h)
 
     // send revoke if we're first in line
     if (st.wanted_by.front() == h)
@@ -177,7 +170,7 @@ int lock_server::acquire(int &r, lock_protocol::lockid_t lid, string id, lock_pr
     return lock_protocol::RETRY;
 }
 
     return lock_protocol::RETRY;
 }
 
-int lock_server::release(int &r, lock_protocol::lockid_t lid, callback id, lock_protocol::xid_t xid) {
+int lock_server::release(int &, lock_protocol::lockid_t lid, callback id, lock_protocol::xid_t xid) {
     LOG_FUNC_ENTER_SERVER;
     lock_state &st = get_lock_state(lid);
     lock sl(st.m);
     LOG_FUNC_ENTER_SERVER;
     lock_state &st = get_lock_state(lid);
     lock sl(st.m);
@@ -206,7 +199,7 @@ void lock_server::unmarshal_state(string state) {
 }
 
 lock_protocol::status lock_server::stat(int &r, lock_protocol::lockid_t lid) {
 }
 
 lock_protocol::status lock_server::stat(int &r, lock_protocol::lockid_t lid) {
-    printf("stat request\n");
+    LOG("stat request for " << lid);
     VERIFY(0);
     r = nacquire;
     return lock_protocol::OK;
     VERIFY(0);
     r = nacquire;
     return lock_protocol::OK;