src/core/interface.c

Go to the documentation of this file.
00001 
00010 #include <sys/time.h>
00011 #include <errno.h>
00012 #include <pthread.h>
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 #include <setjmp.h>
00016 #include <assert.h>
00017 #include <sched.h>
00018 #include <misc/debug.h>
00019 #include <misc/generic_types.h>
00020 #include <core/stats.h>
00021 #include <core/sentinel.h>
00022 #include <core/koa.h>
00023 #include <core/fm.h>
00024 #include <core/buffer.h>
00025 #include <core/config.h>
00026 #include <core/tx.h>
00027 
00028 
00029 extern txc_sentinelmgr_t *txc_g_sentinelmgr;
00030 extern txc_buffermgr_t *txc_g_buffermgr;
00031 extern txc_koamgr_t *txc_g_koamgr;
00032 extern txc_txmgr_t *txc_g_txmgr;
00033 extern txc_statsmgr_t *txc_g_statsmgr;
00034 
00035 
00036 struct timeval txc_initialization_time;
00037 
00045 int
00046 _TXC_global_init()
00047 {
00048         txc_config_init();
00049         txc_sentinelmgr_create(&txc_g_sentinelmgr);
00050         txc_buffermgr_create(&txc_g_buffermgr);
00051 #ifdef _TXC_STATS_BUILD 
00052         txc_statsmgr_create(&txc_g_statsmgr);
00053 #endif  
00054         txc_txmgr_create(&txc_g_txmgr, txc_g_buffermgr, txc_g_sentinelmgr, 
00055                          txc_g_statsmgr);
00056         txc_koamgr_create(&txc_g_koamgr, txc_g_sentinelmgr, txc_g_buffermgr);
00057 
00058         if (txc_runtime_settings.debug_all == TXC_BOOL_TRUE) {
00059                 txc_runtime_settings.debug_koa      = TXC_BOOL_TRUE;
00060                 txc_runtime_settings.debug_pool     = TXC_BOOL_TRUE;
00061                 txc_runtime_settings.debug_sentinel = TXC_BOOL_TRUE;
00062                 txc_runtime_settings.debug_tx       = TXC_BOOL_TRUE;
00063                 txc_runtime_settings.debug_xcall    = TXC_BOOL_TRUE;
00064         }
00065 
00066         return (int) TXC_R_SUCCESS;
00067 }
00068 
00069 
00077 int
00078 _TXC_global_shutdown()
00079 {
00080         txc_stats_print(txc_g_statsmgr);
00081 
00082         return (int) TXC_R_SUCCESS;
00083 }
00084 
00085 
00091 int
00092 _TXC_thread_init()
00093 {
00094         txc_tx_create(txc_g_txmgr, &txc_l_txd);
00095         return (int) TXC_R_SUCCESS;
00096 }
00097 
00098 
00107 void                                                                          
00108 _TXC_transaction_abort(txc_tx_abortreason_t abort_reason)
00109 {
00110         txc_tx_abort_transaction(txc_l_txd, abort_reason);
00111 }
00112 
00113 
00123 txc_tx_xactstate_t
00124 _TXC_get_xactstate() 
00125 {
00126         txc_tx_t *txd = txc_l_txd;
00127 
00128         return txc_tx_get_xactstate(txd);
00129 }
00130 
00131 
00141 void
00142 _TXC_transaction_pre_begin(const char *srcloc_str, const char *src_file, const char *src_fun, int src_line)
00143 {
00144         txc_tx_t        *txd   = txc_l_txd;
00145         txc_tx_srcloc_t srcloc = {src_file, src_fun, src_line};
00146 
00147         txc_tx_pre_begin(txd, srcloc_str, &srcloc);
00148 }
00149 
00150 
00154 void
00155 _TXC_transaction_post_begin()
00156 {
00157         txc_tx_t        *txd   = txc_l_txd;
00158 
00159         txc_tx_post_begin(txd);
00160 }
00161 
00162 
00166 void
00167 _TXC_fm_register(int flags, int *err)
00168 {
00169         txc_tx_t        *txd   = txc_l_txd;
00170 
00171         txc_fm_register(txd, flags, err);
00172 }

Generated on Wed Dec 9 20:32:39 2009 for xCalls by  doxygen 1.4.7