コード例 #1
0
 public AsyncLockWorker(IAsyncLockUC syncPrimitive,
                        IBenchmarkConfiguration benchmarkConfiguration,
                        string resourceName,
                        string pair)
     :       base(benchmarkConfiguration, resourceName, pair)
 {
     Lock = syncPrimitive;
 }
        private static async Task ConcurrentSequencingWorker(IAsyncLockUC Lock, ISequencerUC sequencer)
        {
            await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhase.Begin);

            await sequencer.PointAsync(SeqPointTypeUC.Notify, ConcurrentSequencingPhase.EnteringSimpleLock, Interlocked.Increment(ref StepConcurrentSequencing));

            using (await Lock.Enter())
            {
                await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhase.Locked, Interlocked.Decrement(ref StepConcurrentSequencing));

                await sequencer.PointAsync(SeqPointTypeUC.Notify, ConcurrentSequencingPhase.LockedNotify, Interlocked.Add(ref StepConcurrentSequencing, 0));
            }
            await sequencer.PointAsync(SeqPointTypeUC.Match, ConcurrentSequencingPhase.End);
        }
コード例 #3
0
 public AsyncLockWorker(IPerfCounterCollectorUC perfCollector, IAsyncLockUC syncPrimitive, TimeSpan ts, int spin, string pair = null) : base(perfCollector, ts, spin, pair)
 {
     Lock = syncPrimitive;
 }