using System.Collections.Generic;
using System.Threading.Tasks;
private static SemaphoreSlim _sem = new(0, 1);
private static async Task RunMeAsync()
Console.WriteLine("Before WaitAsync, tid = " + Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("After WaitAsync, tid = " + Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("Finish");
public static async Task Main()
Console.WriteLine("====" + _sem.CurrentCount);