Skip to content

Instantly share code, notes, and snippets.

/a.cs

Created December 13, 2017 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/05dc32470bc1dc7a88073754ed0b507e to your computer and use it in GitHub Desktop.
Save anonymous/05dc32470bc1dc7a88073754ed0b507e to your computer and use it in GitHub Desktop.
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