using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
ManualResetEvent manual = new ManualResetEvent(false);
for (int i = 0; i < 10000; i++)
{
Stopwatch watch1 = Stopwatch.StartNew();
var local = i;
Task.Run(() =>
{
watch1.Stop();
Console.WriteLine($"#{local} Elapsed: {watch1.ElapsedMilliseconds} ThreadId: {Thread.CurrentThread.ManagedThreadId }");
manual.WaitOne();
});
}
manual.WaitOne();
}
}
Created
February 22, 2021 02:39
-
-
Save davkean/7785a5f01654bcb94adcc1a26d87742f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment