Ads
Comments 4
I have used SemaphoreSlim class for such purpuses.

private readonly SemaphoreSlim syncObject = new SemaphoreSlim(1);
...
      syncObject.Wait();
      try {
        // CODE YOU WANT TO DEBUG
      }
      finally {
        syncObject.Release();
      }
Only those users with full accounts are able to leave comments. , please.