projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed two major bugs in paxos.cc.
[invirt/third/libt4.git]
/
lock_server.cc
diff --git
a/lock_server.cc
b/lock_server.cc
index
379838a
..
81cd805
100644
(file)
--- a/
lock_server.cc
+++ b/
lock_server.cc
@@
-23,25
+23,16
@@
lock_state& lock_state::operator=(const lock_state& o) {
return *this;
}
return *this;
}
-marshall & operator<<(marshall &m, const lock_state &d) {
- return m << d.held << d.held_by << d.wanted_by;
-}
-
-unmarshall & operator>>(unmarshall &u, lock_state &d) {
- return u >> d.held >> d.held_by >> d.wanted_by;
-}
-
lock_state & lock_server::get_lock_state(lock_protocol::lockid_t lid) {
lock sl(lock_table_lock);
lock_state & lock_server::get_lock_state(lock_protocol::lockid_t lid) {
lock sl(lock_table_lock);
- // by the semantics of map, this will create
- // the lock if it doesn't already exist
+ // this will create the lock if it doesn't already exist
return lock_table[lid];
}
return lock_table[lid];
}
-lock_server::lock_server(class rsm *_rsm) : rsm (_rsm) {
- std::thread(&lock_server::revoker, this).detach();
- std::thread(&lock_server::retryer, this).detach();
- rsm->set_state_transfer(this);
+lock_server::lock_server(rsm *r) : rsm_ (r) {
+ thread(&lock_server::revoker, this).detach();
+ thread(&lock_server::retryer, this).detach();
+ rsm_->set_state_transfer(this);
}
void lock_server::revoker() [[noreturn]] {
}
void lock_server::revoker() [[noreturn]] {
@@
-49,7
+40,7
@@
void lock_server::revoker() [[noreturn]] {
lock_protocol::lockid_t lid;
revoke_fifo.deq(&lid);
LOG("Revoking " << lid);
lock_protocol::lockid_t lid;
revoke_fifo.deq(&lid);
LOG("Revoking " << lid);
- if (rsm && !rsm->amiprimary())
+ if (rsm_ && !rsm_->amiprimary())
continue;
lock_state &st = get_lock_state(lid);
continue;
lock_state &st = get_lock_state(lid);
@@
-76,7
+67,7
@@
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);
- if (rsm && !rsm->amiprimary())
+ if (rsm_ && !rsm_->amiprimary())
continue;
LOG("Sending retry for " << lid);
continue;
LOG("Sending retry for " << lid);
@@
-176,16
+167,14
@@
int lock_server::release(int &, lock_protocol::lockid_t lid, callback_t id, lock
string lock_server::marshal_state() {
lock sl(lock_table_lock);
marshall rep;
string lock_server::marshal_state() {
lock sl(lock_table_lock);
marshall rep;
- rep << nacquire;
- rep << lock_table;
- return rep.str();
+ rep << nacquire << lock_table;
+ return rep.content();
}
void lock_server::unmarshal_state(string state) {
lock sl(lock_table_lock);
}
void lock_server::unmarshal_state(string state) {
lock sl(lock_table_lock);
- unmarshall rep(state);
- rep >> nacquire;
- rep >> lock_table;
+ unmarshall rep(state, false);
+ rep >> nacquire >> lock_table;
}
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) {