Пример #1
0
 public void SyncExceptionTestMethod(ILockUC spinlock)
 {
     using (spinlock.Enter())
     {
         throw new Exception();
     }
 }
Пример #2
0
 public GeneralLockWorker(ILockUC syncPrimitive,
                          IBenchmarkConfiguration benchmarkConfiguration,
                          string resourceName,
                          string pair)
     : base(benchmarkConfiguration, resourceName, pair)
 {
     Lock = syncPrimitive;
 }
 private static void ConcurrentSequencingEnterWorker(ILockUC Lock, ISequencerUC sequencer)
 {
     sequencer.Point(SeqPointTypeUC.Match, ConcurrentSequencingEnterPhase.Begin);
     sequencer.Point(SeqPointTypeUC.Notify, ConcurrentSequencingEnterPhase.EnteringSimpleLock, Interlocked.Increment(ref StepConcurrentSequencing));
     using (Lock.Enter())
     {
         sequencer.Point(SeqPointTypeUC.Match, ConcurrentSequencingEnterPhase.Locked, Interlocked.Decrement(ref StepConcurrentSequencing));
         sequencer.Point(SeqPointTypeUC.Notify, ConcurrentSequencingEnterPhase.LockedNotify, Interlocked.Add(ref StepConcurrentSequencing, 0));
     }
     sequencer.Point(SeqPointTypeUC.Match, ConcurrentSequencingEnterPhase.End);
 }
        private static async Task ConcurrentSequencingAsyncWorker(ILockUC spinLock, ISequencerUC sequencer)
        {
            await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhaseAsync.Begin);

            await sequencer.PointAsync(SeqPointTypeUC.Notify, ConcurrentSequencingPhaseAsync.EnteringSpinLock, Interlocked.Increment(ref StepConcurrentSequencingAsync));

            using (spinLock.Enter())
            {
                await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhaseAsync.Locked, Interlocked.Decrement(ref StepConcurrentSequencingAsync));

                await sequencer.PointAsync(SeqPointTypeUC.Notify, ConcurrentSequencingPhaseAsync.LockedNotify, Interlocked.Add(ref StepConcurrentSequencingAsync, 0));
            }
            await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhaseAsync.End);
        }
 private static void ConcurrentSequencingWorker(ILockUC Lock, ISequencerUC sequencer)
 {
     sequencer.Point(SeqPointTypeUC.Match, ConcurrentTryEnterDelaySequencingPhase.Begin);
     sequencer.Point(SeqPointTypeUC.Notify, ConcurrentTryEnterDelaySequencingPhase.EnteringSimpleLock, Interlocked.Increment(ref StepConcurrentSequencing));
     using (EntryBlockUC entry = Lock.TryEnter(150))
     {
         sequencer.PointArg(SeqPointTypeUC.Match, ConcurrentTryEnterDelaySequencingPhase.Entry, entry.HasEntry);
         if (entry.HasEntry)
         {
             sequencer.Point(SeqPointTypeUC.Match, ConcurrentTryEnterDelaySequencingPhase.Locked, Interlocked.Decrement(ref StepConcurrentSequencing));
             sequencer.Point(SeqPointTypeUC.Notify, ConcurrentTryEnterDelaySequencingPhase.LockedNotify, Interlocked.Add(ref StepConcurrentSequencing, 0));
         }
     }
     sequencer.Point(SeqPointTypeUC.Match, ConcurrentTryEnterDelaySequencingPhase.End);
 }
Пример #6
0
 private static void ConcurrentSequencingConditionalWorker(ISequencerUC sequencer, ILockUC spinLock)
 {
     ConditionalSequencerUC.Point(sequencer, SeqPointTypeUC.Match, ConcurrentSequencingPhaseConditional.Begin);
     ConditionalSequencerUC.Point(sequencer, SeqPointTypeUC.Notify, ConcurrentSequencingPhaseConditional.EnteringSpinLock, Interlocked.Increment(ref StepConcurrentSequencingConditional));
     using (spinLock.Enter())
     {
         ConditionalSequencerUC.Point(sequencer, SeqPointTypeUC.Match, ConcurrentSequencingPhaseConditional.Locked, Interlocked.Decrement(ref StepConcurrentSequencingConditional));
         ConditionalSequencerUC.Point(sequencer, SeqPointTypeUC.Notify, ConcurrentSequencingPhaseConditional.LockedNotify, Interlocked.Add(ref StepConcurrentSequencingConditional, 0));
     }
     ConditionalSequencerUC.Point(sequencer, SeqPointTypeUC.Match, ConcurrentSequencingPhaseConditional.End);
 }
 public SimpleLockWorker(IPerfCounterCollectorUC perfCollector, ILockUC syncPrimitive, TimeSpan ts, int spin, string pair = null) : base(perfCollector, ts, spin, pair)
 {
     Lock = syncPrimitive;
 }