Major clean-ups. Migrating to C++11.
[invirt/third/libt4.git] / lock_server.h
1 // this is the lock server
2 // the lock client has a similar interface
3
4 #ifndef lock_server_h
5 #define lock_server_h
6
7 #include <string>
8 #include "lock_protocol.h"
9 #include "lock_client.h"
10 #include "rpc/rpc.h"
11 #include <list>
12 #include <map>
13
14 using std::map;
15
16 typedef map<lock_protocol::lockid_t, mutex> lock_map;
17
18 class lock_server {
19
20  protected:
21   int nacquire;
22   mutex lock_lock;
23   lock_map locks;
24   mutex &get_lock(lock_protocol::lockid_t lid);
25
26  public:
27   lock_server();
28   ~lock_server() {};
29   lock_protocol::status stat(int clt, lock_protocol::lockid_t lid, int &);
30   lock_protocol::status acquire(int clt, lock_protocol::lockid_t lid, int &);
31   lock_protocol::status release(int clt, lock_protocol::lockid_t lid, int &);
32 };
33
34 #endif