projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More clean-ups and cool template stuff
[invirt/third/libt4.git]
/
lock_client.h
diff --git
a/lock_client.h
b/lock_client.h
index
541cc23
..
3290d1a
100644
(file)
--- a/
lock_client.h
+++ b/
lock_client.h
@@
-12,6
+12,7
@@
#include "lang/verify.h"
#include "rpc/fifo.h"
#include "rsm_client.h"
#include "lang/verify.h"
#include "rpc/fifo.h"
#include "rsm_client.h"
+#include "lock.h"
class lock_release_user {
public:
class lock_release_user {
public:
@@
-20,15
+21,12
@@
class lock_release_user {
};
using std::string;
};
using std::string;
+using std::map;
using std::thread;
using std::list;
using std::thread;
using std::list;
-using std::map;
-
-typedef string callback;
class lock_state {
public:
class lock_state {
public:
- lock_state();
enum {
none = 0,
retrying,
enum {
none = 0,
retrying,
@@
-36,15
+34,15
@@
public:
locked,
acquiring,
releasing
locked,
acquiring,
releasing
- } state;
- std::thread::id held_by;
- list<std::thread::id> wanted_by;
+ } state = none;
+ thread::id held_by;
+ list<thread::id> wanted_by;
mutex m;
mutex m;
- map<std::thread::id, std::condition_variable> c;
+ map<thread::id, cond> c;
lock_protocol::xid_t xid;
lock_protocol::xid_t xid;
- void wait();
+ void wait(lock & mutex_lock);
void signal();
void signal();
- void signal(std::thread::id who);
+ void signal(thread::id who);
};
typedef map<lock_protocol::lockid_t, lock_state> lock_map;
};
typedef map<lock_protocol::lockid_t, lock_state> lock_map;
@@
-54,7
+52,7
@@
typedef map<lock_protocol::lockid_t, lock_state> lock_map;
class lock_client {
private:
rpcc *cl;
class lock_client {
private:
rpcc *cl;
- std::thread releaser_thread;
+ thread releaser_thread;
rsm_client *rsmc;
class lock_release_user *lu;
unsigned int rlock_port;
rsm_client *rsmc;
class lock_release_user *lu;
unsigned int rlock_port;