C# How To Achieve Monitor.Enter/Exit With Task Based Async
问题 This is my code that works. I wouldn't have to do this if it weren't task based async, but using Monitor.Enter/Exit results in this problem Object synchronization method was called from an unsynchronized block of code. Exception on Mutex.Release() People have mentioned using AutoResetEvent, and SemaphoreSlim, but I'm not quite sure which pattern fits. private bool fakelock; internal async Task<byte[][]> ExchangeCore(byte[][] apdus) { if (apdus == null || apdus.Length == 0) return null; List