using System;
using System.Threading.Tasks;
using System.Threading;
public class Program
{
public static void Main()
Test().Wait();
}
public static async Task Test(){
var o = new object();
bool taken = false;
try{
Monitor.Enter(o, ref taken);
Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
await Task.Delay(100);
}finally{
if(taken){
Monitor.Exit(o);