public void RunSequence5() { for (var i = 0; i < LoopCount; i++) { manager5.AcquireLock("key5"); manager5.Release("key5"); } }
public async Task RunParallel() { var keys = new[] { "key1", "key2", "key3", "key4", "key5" }; await Task.WhenAll(keys.Select(key => Task.Run(() => { for (var i = 0; i < LoopCount; i++) { manager.AcquireLock(key); manager.Release(key); } }))); }