Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Created May 12, 2020 15:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevingosse/d342dc59c38c9c63532999953239861b to your computer and use it in GitHub Desktop.
Save kevingosse/d342dc59c38c9c63532999953239861b to your computer and use it in GitHub Desktop.
var cts = new CancellationTokenSource();
cts.Token.Register(() => Thread.Sleep(5000));
cts.Cancel(); // This call will block during 5 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment