-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlock_server.h
More file actions
49 lines (30 loc) · 841 Bytes
/
lock_server.h
File metadata and controls
49 lines (30 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// this is the lock server
// the lock client has a similar interface
#ifndef lock_server_h
#define lock_server_h
#include <string>
#include <pthread.h>
#include "lock_protocol.h"
#include "lock_client.h"
#include "rpc.h"
typedef struct lock_status {
int clt;
bool st;
} lck;
typedef std::map <lock_protocol::lockid_t, lck> lock;
typedef std::map<lock_protocol::lockid_t, lck>::iterator lock_iterator;
class lock_server {
private:
lock locklist;
pthread_mutex_t table_lock;
protected:
int nacquire;
public:
lock_server();
~lock_server() {
};
lock_protocol::status stat(int clt, lock_protocol::lockid_t lid, int &);
lock_protocol::status acquire(int clt, lock_protocol::lockid_t lid, int &);
lock_protocol::status release(int clt, lock_protocol::lockid_t lid, int &);
};
#endif