/*** Constructor gets a slot in the global epoch */ PrivTFence() { unsigned u = fai(&globals.epoch_size.val); epoch_slot = u; for (int i = 0; i < MAX_THREADS; i++) epoch_buff[i] = 0; }
double f3s(double x1, double x2, double y1, double y2, double b1, double b2, double z ) { double p; if (x2 < x1 || y2 < y1 || b2 < b1) { /* cat("Bad input parameters, upper limits less than lower limits\n"); p = NA; */ /* cng - make a big number to be subtracted and yield ndv */ /* p = 1000.0 */ p = 1000.0; } else if (x1 < 0 || y1 < 0 || b1 < 0) { /* cat("Bad input parameters, Variables cannot be negative\n"); p = NA; */ p = 1000.; } else { if(y1 == y2 || b1 == b2) { /* degenerate on y or b - reverts to additive convolution */ p = f2s(x1,x2,y1*b1,y2*b2,z); } else { if(x2 == x1) { p = fa(y1, y2, b1, b2, z - x1); } else { p = (fai(y1, y2, b1, b2, z - x1) - fai(y1, y2, b1, b2, z - x2)) / (x2 - x1); } } } return p; }
void sense_reverse_barrier(int tid) { static volatile unsigned long count = 0; static volatile unsigned int sense = 0; static volatile unsigned int thread_sense[MAX_THREADS] = {0}; thread_sense[tid] = !thread_sense[tid]; if (fai(&count) == thread_num-1) { count = 0; sense = !sense; } else { while (sense != thread_sense[tid]); /* spin */ } }
/*** commit memops and release inevitability */ void cleanup_inevitable() { // if I have locks, get a commit time if (locks.size() != 0) end_time = 1 + fai(×tamp); // unmark inevitable reads cm.onCommit(); cm.postCommit(locks); // release orecs and clean up releaseAndIncrementLocks(); allocator.onTxCommit(); common_cleanup(); }
/*** Constructor just sets up the lists and vars. */ StrictThread::StrictThread() : OrecWBTxThread(), writes(64), reads(64), locks(64), allocator(), nesting_depth(0), num_commits(0), num_aborts(0), num_retrys(0), num_restarts(0) { #if defined(STM_PRIV_TFENCE) // set up the transactional fence for privatization unsigned k = fai(&priv_epoch_size.val); priv_epoch_slot = k; priv_epoch_buff = (unsigned*)malloc(128 * sizeof(unsigned)); memset((void*)priv_epoch_buff, 0, 128 * sizeof(unsigned)); #endif #if defined(STM_PRIV_COMMIT_FENCE) // set up the commit fence for privatization unsigned k = fai(&cfence_epoch_size.val); cfence_epoch_slot = k; cfence_epoch_buff = (unsigned*)malloc(128 * sizeof(unsigned)); memset((void*)cfence_epoch_buff, 0, 128 * sizeof(unsigned)); #endif // compute my lock word my_lock_word.owner = this; my_lock_word.version.lock = 1; }
/*** Constructor just sets up the lists and vars. */ LLTThread::LLTThread() : OrecWBTxThread(), writes(64), reads(64), locks(64), allocator(), write_filter(0), nesting_depth(0), is_inevitable(false), num_commits(0), num_aborts(0), num_retrys(0), num_restarts(0) { #if defined(STM_INEV_GRL) || defined(STM_INEV_GWLFENCE) unsigned u = fai(&epoch_size.val); epoch_slot = u; epoch_buff = (unsigned*)malloc(128 * sizeof(unsigned)); memset((void*)epoch_buff, 0, 128 * sizeof(unsigned)); #endif #ifdef STM_INEV_DRAIN drain_inev_flag = 0; #endif // compute my lock word my_lock_word.owner = this; my_lock_word.version.lock = 1; }
virtual void onTransactionCommitted() { priority = 0; timestamp = fai(&timeCounter); }
Greedy() : waiting(false) { timestamp = fai(&timeCounter); }
inline void inc() { fai(&counter); }