Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

I want to stop my application when I press Ctrl + c and my code is in below #338

Closed
divnit opened this issue Sep 22, 2018 · 0 comments
Closed

Comments

@divnit
Copy link

divnit commented Sep 22, 2018

public async Task StopAsync(CancellationToken cancellationToken)
{
if (_executingTask == null)
{
return;
}

        _cts.Cancel();

        await Task.WhenAny(_executingTask, Task.Delay(-1, cancellationToken));

        cancellationToken.ThrowIfCancellationRequested();
    }
@divnit divnit closed this as completed Sep 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant