-
-
Save anonymous/05dc32470bc1dc7a88073754ed0b507e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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