예제 #1
0
 private void AcquireLock(ShadowThread runningThread, string memberName, string sourceFilePath, int sourceLineNumber)
 {
     // TODO: inc clock?
     runningThread.ReleasesAcquired.Join(_lockClock);
     _heldBy = runningThread;
     _timesEntered++;
 }
예제 #2
0
        public T Exchange(T newData, MemoryOrder mo, ShadowThread runningThread)
        {
            var oldData = _history.RecordRMWLoad(mo, runningThread);

            _history.RecordRMWStore(newData, mo, runningThread);
            return(oldData);
        }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }
예제 #5
0
        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();
        }
예제 #6
0
        public T Load(MemoryOrder mo, ShadowThread runningThread)
        {
            T result = _history.RecordPossibleLoad(mo, runningThread);

            return(result);
        }
예제 #7
0
 public void Store(T data, MemoryOrder mo, ShadowThread runningThread)
 {
     _history.RecordStore(data, mo, runningThread);
 }