Mercurial > repos > rhope
diff 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 |
line wrap: on
line diff
--- a/runtime/transaction.h Tue Nov 16 21:53:18 2010 -0500 +++ b/runtime/transaction.h Fri Nov 19 04:04:14 2010 -0500 @@ -1,7 +1,8 @@ -#ifndef THREAD_H_ -#define THREAD_H_ +#ifndef TRANSACTION_H_ +#define TRANSACTION_H_ #include "object.h" +#include "thread.h" typedef struct { @@ -10,12 +11,13 @@ int32_t version; } mutable_object; -typedef struct +typedef struct trans_cell { - mutable_object *obj; - object **commit_loc; - int32_t orig_version; - int32_t local_version; + mutable_object *obj; + struct trans_cell *parent; + object *local_data; + int32_t orig_version; + int32_t local_version; } trans_cell; @@ -23,8 +25,16 @@ { struct transaction *parent; rh_mutex(lock) + struct transaction *chain; int32_t num_cells; - trans_cell[1] cells; + trans_cell cells[1]; } transaction; -#endif //THREAD_H_ +#include "context.h" + +trans_cell * find_obj_cell(transaction * trans, mutable_object * to_find); +void begin_transaction(struct context * ct, int numobjs,...); +int32_t commit_transaction(struct context * ct, int32_t readonly); +void prep_retry(struct context * ct); + +#endif //TRANSACTION_H_