/* * Initialize module. */ void mod_order_init(void) { if (mod_order_initialized) return; #if CM == CM_MODULAR if (!stm_register(NULL, NULL, mod_order_on_start, mod_order_on_precommit, mod_order_on_commit, NULL, NULL)) { fprintf(stderr, "Could not set callbacks for module 'mod_order'. Exiting.\n"); goto err; } if (stm_set_parameter("cm_function", mod_order_cm) == 0) { fprintf(stderr, "Could not set contention manager for module 'mod_order'. Exiting.\n"); goto err; } mod_order_key = stm_create_specific(); if (mod_order_key < 0) { fprintf(stderr, "Cannot create specific key\n"); goto err; } mod_order_initialized = 1; return; err: #else /* CM != CM_MODULAR */ fprintf(stderr, "The 'mod_order' module requires CM_MODULAR.\n"); #endif /* CM != CM_MODULAR */ exit(1); }
/* * Initialize module. */ void mod_cb_init() { if (mod_cb_initialized) return; stm_register(mod_cb_on_thread_init, mod_cb_on_thread_exit, NULL, NULL, mod_cb_on_commit, mod_cb_on_abort, NULL); mod_cb_key = stm_create_specific(); if (mod_cb_key < 0) { fprintf(stderr, "Cannot create specific key\n"); exit(1); } mod_cb_initialized = 1; }