Creates a new CancellationToken
or cancels one that has already created. There is a 1:1 CancellationTokenSource
to CancellationToken
relationship.
To create a CancellationToken
,
create a CancellationTokenSource
first and then call getToken()
to get the CancellationToken
for this CancellationTokenSource
.
See Also
Public Constructor Summary
CancellationTokenSource()
Creates a new
CancellationTokenSource
instance.
|
Public Method Summary
void |
cancel()
Cancels the
CancellationToken
if cancellation has not been requested yet.
|
CancellationToken |
getToken()
Gets the
CancellationToken
for this CancellationTokenSource .
|
Inherited Method Summary
Public Constructors
public CancellationTokenSource ()
Creates a new CancellationTokenSource
instance.
Public Methods
public void cancel ()
Cancels the CancellationToken
if cancellation has not been requested yet.
public CancellationToken getToken ()
Gets the CancellationToken
for this CancellationTokenSource
.
Returns
- the
CancellationToken
that can be passed to asynchronousTask
to cancel the Task.