X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5987a5357ccfd818d540a7aa58eb498a1be07aa1..2546a41ad36fdc9ef6471cb35a1d56930ae1b527:/lock_server.cc diff --git a/lock_server.cc b/lock_server.cc index f5a1fc4..cac6a90 100644 --- a/lock_server.cc +++ b/lock_server.cc @@ -2,12 +2,11 @@ #include "lock_server.h" #include -#include #include #include #include "lang/verify.h" #include "handle.h" -#include "tprintf.h" +#include "threaded_log.h" #include "rpc/marshall.h" #include "lock.h" @@ -32,12 +31,6 @@ lock_state& lock_state::operator=(const lock_state& o) { return *this; } -template -ostringstream & operator<<(ostringstream &o, const pair &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; } @@ -59,7 +52,7 @@ lock_server::lock_server(class rsm *_rsm) : rsm (_rsm) { 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); @@ -81,13 +74,13 @@ void lock_server::revoker() { proxy = handle(held_by.first).safebind(); if (proxy) { int r; - rlock_protocol::status ret = proxy->call(rlock_protocol::revoke, r, lid, held_by.second); + auto ret = (rlock_protocol::status)proxy->call(rlock_protocol::revoke, r, lid, held_by.second); LOG("Revoke returned " << ret); } } } -void lock_server::retryer() { +void lock_server::retryer() [[noreturn]] { while (1) { lock_protocol::lockid_t lid; retry_fifo.deq(&lid); @@ -104,8 +97,6 @@ void lock_server::retryer() { front = st.wanted_by.front(); } - rlock_protocol::status ret = -1; - rpcc *proxy = NULL; // try a few times? //int t=5; @@ -113,13 +104,13 @@ void lock_server::retryer() { proxy = handle(front.first).safebind(); if (proxy) { int r; - ret = proxy->call(rlock_protocol::retry, r, lid, front.second); + auto ret = (rlock_protocol::status)proxy->call(rlock_protocol::retry, r, lid, front.second); LOG("Retry returned " << ret); } } } -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); @@ -168,7 +159,7 @@ int lock_server::acquire(int &r, lock_protocol::lockid_t lid, string id, lock_pr 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) @@ -177,7 +168,7 @@ int lock_server::acquire(int &r, lock_protocol::lockid_t lid, string id, lock_pr 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); @@ -206,7 +197,7 @@ void lock_server::unmarshal_state(string state) { } 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;