Mercurial > repos > rhope
view runtime/transaction.h @ 189:d0e3a13c1bd9 default tip
Remove old calculator example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Oct 2011 00:24:04 -0700 |
parents | ba35ab624ec2 |
children |
line wrap: on
line source
#ifndef TRANSACTION_H_ #define TRANSACTION_H_ #include "object.h" #include "thread.h" typedef struct { object header; object * data; int32_t version; } mutable_object; typedef struct trans_cell { mutable_object *obj; struct trans_cell *parent; object *local_data; int32_t orig_version; int32_t local_version; } trans_cell; typedef struct transaction { struct transaction *parent; rh_mutex(lock) struct transaction *chain; int32_t num_cells; trans_cell cells[1]; } transaction; #include "context.h" trans_cell * find_obj_cell(transaction * trans, mutable_object * to_find); #ifdef RAW_FUNC #define begin_transaction(ct, numobjs, ...) real_begin_transaction(numobjs, __VA_ARGS__) void real_begin_transaction(int numobjs,...); #define commit_transaction(ct, readonly) real_commit_transaction(readonly) int32_t real_commit_transaction(int32_t readonly); #define prep_retry(ct) real_prep_retry() void prep_retry(); extern transaction * cur_transaction; #else void begin_transaction(struct context * ct, int numobjs,...); int32_t commit_transaction(struct context * ct, int32_t readonly); void prep_retry(struct context * ct); #define cur_transaction ct->transaction #endif #endif //TRANSACTION_H_