public void Do2(int i) { Task.Factory.StartNew(async() => { var r = await AsyncMonitor.TryEnter(locker2, 20); Console.WriteLine($"before {i} {r}"); if (r) { Console.WriteLine($"locked {i}"); try { Thread.Sleep(100); } finally { AsyncMonitor.Exit(locker2); } } else { Console.WriteLine($"not locked {i}"); } }); }