1 // lock client interface.
9 #include "lock_protocol.h"
11 #include "rsm_client.h"
13 class lock_release_user {
15 virtual void dorelease(lock_protocol::lockid_t) = 0;
16 virtual ~lock_release_user() {}
30 list<thread::id> wanted_by;
32 map<thread::id, cond> c;
33 lock_protocol::xid_t xid;
34 void wait(lock & mutex_lock);
36 void signal(thread::id who);
39 typedef map<lock_protocol::lockid_t, lock_state> lock_map;
41 // Clients that caches locks. The server can revoke locks using
42 // lock_revoke_server.
46 thread releaser_thread;
48 lock_release_user *lu;
53 lock_protocol::xid_t next_xid;
54 fifo<lock_protocol::lockid_t> release_fifo;
55 mutex lock_table_lock;
57 lock_state &get_lock_state(lock_protocol::lockid_t lid);
59 static in_port_t last_port;
60 lock_client(string xdst, lock_release_user *l = 0);
62 lock_protocol::status acquire(lock_protocol::lockid_t);
63 lock_protocol::status release(lock_protocol::lockid_t);
64 int stat(lock_protocol::lockid_t);
66 rlock_protocol::status revoke_handler(int &, lock_protocol::lockid_t, lock_protocol::xid_t);
67 rlock_protocol::status retry_handler(int &, lock_protocol::lockid_t, lock_protocol::xid_t);
74 struct _t4_lock_client;
75 typedef struct _t4_lock_client t4_lock_client;
85 typedef int t4_status;
87 typedef const char * t4_lockid_t;
89 t4_lock_client *t4_lock_client_new(const char *dst);
90 void t4_lock_client_delete(t4_lock_client *);
91 t4_status t4_lock_client_acquire(t4_lock_client *, t4_lockid_t);
92 t4_status t4_lock_client_release(t4_lock_client *, t4_lockid_t);
93 t4_status t4_lock_client_stat(t4_lock_client *, t4_lockid_t);