private void AcquireLock(ShadowThread runningThread, string memberName, string sourceFilePath, int sourceLineNumber) { // TODO: inc clock? runningThread.ReleasesAcquired.Join(_lockClock); _heldBy = runningThread; _timesEntered++; }
public T Exchange(T newData, MemoryOrder mo, ShadowThread runningThread) { var oldData = _history.RecordRMWLoad(mo, runningThread); _history.RecordRMWStore(newData, mo, runningThread); return(oldData); }
public bool CompareExchange(T newData, T comparand, MemoryOrder mo, ShadowThread runningThread, out T loadedData) { loadedData = _history.RecordRMWLoad(mo, runningThread); if (loadedData == null && comparand == null || loadedData != null && loadedData.Equals(comparand)) { _history.RecordRMWStore(newData, mo, runningThread); return(true); } return(false); }
private void ReleaseLock(object lockObject, string memberName, string sourceFilePath, int sourceLineNumber) { // TODO: inc clock? _lockClock.Join(_heldBy.ReleasesAcquired); _timesEntered--; if (_timesEntered == 0) { _heldBy = null; } TE.LockReleased(lockObject); }
public void RunTest(IRelaTest test, IScheduler scheduler, ulong liveLockLimit) { NumThreads = test.ThreadEntries.Count; _scheduler = scheduler; LiveLockLimit = liveLockLimit; TestFailed = false; _shadowThreads = new ShadowThread[NumThreads]; _eventLog = new EventLog(NumThreads); _testStarted = false; SequentiallyConsistentFence = new VectorClock(NumThreads); ExecutionLength = 0; for (int i = 0; i < NumThreads; ++i) { _shadowThreads[i] = new ShadowThread(i, NumThreads); } _testThreads = new TestThreads(test, _scheduler); test.OnBegin(); _testStarted = true; _testThreads.WakeThread(); _testThreads.Join(); test.OnFinished(); }
public T Load(MemoryOrder mo, ShadowThread runningThread) { T result = _history.RecordPossibleLoad(mo, runningThread); return(result); }
public void Store(T data, MemoryOrder mo, ShadowThread runningThread) { _history.RecordStore(data, mo, runningThread); }