Skip to content

Commit 88d1dc7

Browse files
authored
Update CancellationTokenSource.xml (#3982)
Add note to Dispose documentation to highlight that the `CancellationTokenSource` does not cancel its underlying `CancellationToken` when it is disposed, and that cancellation must be triggered separately.
1 parent 667e302 commit 88d1dc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xml/System.Threading/CancellationTokenSource.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,9 @@
710710
711711
## Remarks
712712
Call `Dispose` when you are finished using the <xref:System.Threading.CancellationTokenSource>. The `Dispose` method leaves the <xref:System.Threading.CancellationTokenSource> in an unusable state. After calling `Dispose`, you must release all references to the <xref:System.Threading.CancellationTokenSource> so the garbage collector can reclaim the memory that the <xref:System.Threading.CancellationTokenSource> was occupying.
713-
713+
714+
Note that calling `Dispose` does not communicate a request for cancellation to consumers of the associated <xref:System.Threading.CancellationTokenSource.Token%2A>. You can communicate a request for cancellation by calling methods such as <xref:System.Threading.CancellationTokenSource.Cancel%2A> or <xref:System.Threading.CancellationTokenSource.CancelAfter%2A>.
715+
714716
For more information, see [Cleaning Up Unmanaged Resources](~/docs/standard/garbage-collection/unmanaged.md) and [Implementing a Dispose Method](~/docs/standard/garbage-collection/implementing-dispose.md).
715717
716718
> [!NOTE]

0 commit comments

Comments
 (0)