view runtime/transaction.h @ 177:e57c151f351e

Get bytecode engine working well enough for naive fib
author Mike Pavone <pavone@retrodev.com>
date Sun, 12 Jun 2011 03:49:51 -0700
parents a68e6828d896
children ba35ab624ec2
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);
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_