comparison runtime/transaction.h @ 139:a68e6828d896

Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
author Mike Pavone <pavone@retrodev.com>
date Fri, 19 Nov 2010 04:04:14 -0500
parents 1411de6050e1
children ba35ab624ec2
comparison
equal deleted inserted replaced
138:1411de6050e1 139:a68e6828d896
1 #ifndef THREAD_H_ 1 #ifndef TRANSACTION_H_
2 #define THREAD_H_ 2 #define TRANSACTION_H_
3 3
4 #include "object.h" 4 #include "object.h"
5 #include "thread.h"
5 6
6 typedef struct 7 typedef struct
7 { 8 {
8 object header; 9 object header;
9 object * data; 10 object * data;
10 int32_t version; 11 int32_t version;
11 } mutable_object; 12 } mutable_object;
12 13
13 typedef struct 14 typedef struct trans_cell
14 { 15 {
15 mutable_object *obj; 16 mutable_object *obj;
16 object **commit_loc; 17 struct trans_cell *parent;
17 int32_t orig_version; 18 object *local_data;
18 int32_t local_version; 19 int32_t orig_version;
20 int32_t local_version;
19 } trans_cell; 21 } trans_cell;
20 22
21 23
22 typedef struct transaction 24 typedef struct transaction
23 { 25 {
24 struct transaction *parent; 26 struct transaction *parent;
25 rh_mutex(lock) 27 rh_mutex(lock)
28 struct transaction *chain;
26 int32_t num_cells; 29 int32_t num_cells;
27 trans_cell[1] cells; 30 trans_cell cells[1];
28 } transaction; 31 } transaction;
29 32
30 #endif //THREAD_H_ 33 #include "context.h"
34
35 trans_cell * find_obj_cell(transaction * trans, mutable_object * to_find);
36 void begin_transaction(struct context * ct, int numobjs,...);
37 int32_t commit_transaction(struct context * ct, int32_t readonly);
38 void prep_retry(struct context * ct);
39
40 #endif //TRANSACTION_H_