CSharp · Console
using System;
using System.Threading.Tasks;
using System.Diagnostics;
var sw = Stopwatch.StartNew();
void Log(string msg) =>
Console.WriteLine($"[{sw.Elapsed.TotalSeconds:0.0}s] [thread {Environment.CurrentManagedThreadId}] {msg}");
void TestWait()
{
var t = Task.Factory.StartNew(() =>
{
Log("Start");
Task.Delay(5000).Wait();
Log("Done");
});
t.Wait();
Log("All done");
}
TestWait();