static void mod_order_on_start(void *arg) { stm_word_t ts; /* Get a timestamp for commit */ ts = ATOMIC_FETCH_INC_FULL(&mod_order_ts_next); stm_set_specific(mod_order_key, (void *)ts); }
/* * Called upon thread creation. */ static void mod_cb_on_thread_init(TXPARAMS void *arg) { mod_cb_info_t *icb; if ((icb = (mod_cb_info_t *)malloc(sizeof(mod_cb_info_t))) == NULL) { perror("malloc"); exit(1); } icb->commit = icb->abort = NULL; stm_set_specific(TXARGS mod_cb_key, icb); }
/* * Called upon thread creation. */ static void mod_alloc_on_thread_init(void *arg) { mod_alloc_info_t *mi; if ((mi = (mod_alloc_info_t *)malloc(sizeof(mod_alloc_info_t))) == NULL) { perror("malloc"); exit(1); } mi->allocated = mi->freed = NULL; stm_set_specific(mod_alloc_key, mi); }
/* * Called upon thread creation. */ static void mod_stats_on_thread_init(TXPARAMS void *arg) { mod_stats_data_t *stats; if ((stats = (mod_stats_data_t *)malloc(sizeof(mod_stats_data_t))) == NULL) { perror("malloc"); exit(1); } stats->commits = 0; stats->retries = 0; stats->retries_acc = 0; stats->retries_cnt = 0; stats->retries_min = ULONG_MAX; stats->retries_max = 0; stm_set_specific(TXARGS mod_stats_key, stats); }