X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5fd8cc8409d0efadc07dfe8d6774ad9ff477663d..0989f6feac9c8e83847165c4abee5273463eaa63:/lock_client_cache_rsm.h diff --git a/lock_client_cache_rsm.h b/lock_client_cache_rsm.h index 28b0323..815224c 100644 --- a/lock_client_cache_rsm.h +++ b/lock_client_cache_rsm.h @@ -6,23 +6,22 @@ #include #include "lock_protocol.h" -#include "rpc.h" +#include "rpc/rpc.h" #include "lock_client.h" #include "lang/verify.h" -#include "mutex.h" #include "rpc/fifo.h" #include "rsm_client.h" -// Classes that inherit lock_release_user can override dorelease so that -// that they will be called when lock_client releases a lock. -// You will not need to do anything with this class until Lab 5. class lock_release_user { public: virtual void dorelease(lock_protocol::lockid_t) = 0; virtual ~lock_release_user() {}; }; -using namespace std; +using std::string; +using std::thread; +using std::list; +using std::map; typedef string callback; @@ -37,14 +36,14 @@ public: acquiring, releasing } state; - pthread_t held_by; - list wanted_by; + std::thread::id held_by; + list wanted_by; mutex m; - map c; + map c; lock_protocol::xid_t xid; void wait(); void signal(); - void signal(pthread_t who); + void signal(std::thread::id who); }; typedef map lock_map; @@ -55,7 +54,7 @@ class lock_client_cache_rsm; // lock_revoke_server. class lock_client_cache_rsm : public lock_client { private: - pthread_t releaser_thread; + std::thread releaser_thread; rsm_client *rsmc; class lock_release_user *lu; int rlock_port; @@ -74,8 +73,8 @@ class lock_client_cache_rsm : public lock_client { lock_protocol::status acquire(lock_protocol::lockid_t); virtual lock_protocol::status release(lock_protocol::lockid_t); void releaser(); - rlock_protocol::status revoke_handler(lock_protocol::lockid_t, lock_protocol::xid_t, int &); - rlock_protocol::status retry_handler(lock_protocol::lockid_t, lock_protocol::xid_t, int &); + rlock_protocol::status revoke_handler(int &, lock_protocol::lockid_t, lock_protocol::xid_t); + rlock_protocol::status retry_handler(int &, lock_protocol::lockid_t, lock_protocol::xid_t); };