X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/61809b48ade4c21b1b01931d520aa2abc7507032..a4175b2e216a20b86cc872dea8a08005c60617a5:/lock_server.cc?ds=sidebyside diff --git a/lock_server.cc b/lock_server.cc index 3801814..be0c1c9 100644 --- a/lock_server.cc +++ b/lock_server.cc @@ -5,6 +5,7 @@ #include #include #include +#include "lock.h" lock_server::lock_server(): nacquire (0) @@ -14,11 +15,10 @@ lock_server::lock_server(): // caller must hold lock_lock mutex & lock_server::get_lock(lock_protocol::lockid_t lid) { - lock_lock.acquire(); + lock ml(lock_lock); // by the semantics of std::map, this will create // the mutex if it doesn't already exist mutex &l = locks[lid]; - lock_lock.release(); return l; } @@ -34,13 +34,13 @@ lock_server::stat(int clt, lock_protocol::lockid_t lid, int &r) lock_protocol::status lock_server::acquire(int clt, lock_protocol::lockid_t lid, int &r) { - get_lock(lid).acquire(); + get_lock(lid).lock(); return lock_protocol::OK; } lock_protocol::status lock_server::release(int clt, lock_protocol::lockid_t lid, int &r) { - get_lock(lid).release(); + get_lock(lid).unlock(); return lock_protocol::OK; }