00001 00007 #ifndef _TXC_SENTINEL_H 00008 #define _TXC_SENTINEL_H 00009 00010 #include <misc/result.h> 00011 00012 00013 #define TXC_SENTINEL_ACQUIRED 0x1 00014 #define TXC_SENTINEL_ACQUIREONRETRY 0x2 00015 /* 00016 * This opaque type is normally defined in tx.h. 00017 * To resolve the circular dependency between tx.h and sentinel.h, 00018 * define this type here and ensure that this type is not redefined. 00019 */ 00020 # ifndef TYPEDEF_TXC_TX_T 00021 # define TYPEDEF_TXC_TX_T 00022 typedef struct txc_tx_s txc_tx_t; 00023 # endif /* TYPEDEF_TXC_TX_T */ 00024 00025 typedef struct txc_sentinel_s txc_sentinel_t; 00026 typedef struct pool_element_sentinel_s pool_element_sentinel_t; 00027 typedef struct txc_sentinelmgr_s txc_sentinelmgr_t; 00028 00029 typedef struct txc_sentinel_list_s txc_sentinel_list_t; 00030 typedef struct txc_sentinel_list_entry_s txc_sentinel_list_entry_t; 00031 00032 extern txc_sentinelmgr_t *txc_g_sentinelmgr; 00033 00034 txc_result_t txc_sentinelmgr_create(txc_sentinelmgr_t **); 00035 void txc_sentinelmgr_destroy(txc_sentinelmgr_t **sentinelmgrp); 00036 txc_result_t txc_sentinel_create(txc_sentinelmgr_t *, txc_sentinel_t **); 00037 void txc_sentinel_destroy(txc_sentinel_t *); 00038 txc_result_t txc_sentinel_list_create(txc_sentinelmgr_t *sentinelmgr, txc_sentinel_list_t **sentinel_list); 00039 txc_result_t txc_sentinel_detach(txc_sentinel_t *sentinel); 00040 txc_result_t txc_sentinel_list_destroy(txc_sentinel_list_t **sentinel_list); 00041 txc_result_t txc_sentinel_list_init(txc_sentinel_list_t *sentinel_list); 00042 txc_result_t txc_sentinel_tryacquire(txc_tx_t *, txc_sentinel_t *, int); 00043 void txc_sentinel_transaction_postbegin(txc_tx_t *txd); 00044 void txc_sentinelmgr_print_pools(txc_sentinelmgr_t *sentinelmgr); 00045 txc_tx_t *txc_sentinel_owner(txc_sentinel_t *sentinel); 00046 txc_result_t txc_sentinel_is_enlisted(txc_tx_t *txd, txc_sentinel_t *sentinel); 00047 txc_result_t txc_sentinel_enlist(txc_tx_t *txd, txc_sentinel_t *sentinel, int flags); 00048 void txc_sentinel_register_sentinelmgr_commit_action(txc_tx_t *txd); 00049 void txc_sentinel_register_sentinelmgr_undo_action(txc_tx_t *txd); 00050 #endif