Create a gist now

Instantly share code, notes, and snippets.

anonymous /a.cs
Created Dec 13, 2017

Embed
What would you like to do?
static void Main(string[] args)
{
Thing current = new Thing(1);
var first = Task.Run(()=>DoStuffTo(current));
var second = Task.Delay(1000).ContinueWith(t => current = null);
Task.WaitAll(first, second);
Console.ReadLine();
}
static void DoStuffTo(in Thing thing)
{
Console.WriteLine($"Press enter to process {thing.Id}");
Console.ReadLine();
Console.WriteLine(thing.SayHello());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment