コード例 #1
0
 public void SyncExceptionTestMethod(ILockUC spinlock)
 {
     using (spinlock.Enter())
     {
         throw new Exception();
     }
 }
コード例 #2
0
 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);
 }
コード例 #3
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);
 }
        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);
        }