Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestController : ApiController
- {
- public Task<bool> Get(int count, CancellationToken cancellationToken)
- {
- return Task.Factory.StartNew(() =>
- {
- int i = 0;
- for (; count --> i ;)
- {
- cancellationToken.ThrowIfCancellationRequested();
- Thread.Sleep(10);
- }
- return true;
- }, cancellationToken);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment