Skip to content

Instantly share code, notes, and snippets.

@azyobuzin
Created May 2, 2014 09:27
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 azyobuzin/a945275d04aba8c048d1 to your computer and use it in GitHub Desktop.
Save azyobuzin/a945275d04aba8c048d1 to your computer and use it in GitHub Desktop.
private static List<byte> TestList = new List<byte>();
static async Task Do()
{
var source = new CancellationTokenSource();
var t = Task.Run(() =>
{
source.Token.Register(() => TestList = null);
for (var i = 0; i < 100000000; i++)
{
TestList.Add(0);
}
}, source.Token);
await Task.Delay(50);
source.Cancel();
await t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment