0:00 / 0:00
Cancellation Tokens with Stephen Toub
dotnet
357K subscribers • 45 videos on Hallway
- Recommended by 2 people: 2 in engineering communities.
- Presented by Stephen Toub
- Made by the vendor. The company whose product it covers made or sponsored it.
Intermediate. Assumes working knowledge.
43K views11 months ago2 recommendations
Systems programmingProgramming languagesConcurrency and parallelismC# and .NETPerformance and optimization
Stephen Toub explains the history, implementation, and best practices of cooperative cancellation and cancellation tokens in .NET.
Scott and Stephen are back with another episode of Deep .NET, this time tackling Cancellation Tokens. From the early days of .NET’s “violent” thread aborts to today’s cooperative cancellation model, they explore how tokens provide a safe, composable way to stop work you no longer need. Stephen walks through the evolution from APM and EPM patterns, explains why explicit token passing beats ambient scopes, and shows how cancellation propagates through async calls. Along the way, they dig into cancellation token sources, registration callbacks, and even the role of volatile in multi-threaded code. If you’ve ever wondered how to gracefully cancel tasks without wasting resources, this episode is for you. ⌚ Chapters: Introduction, banter, and setup for Deep .NET episode Why cancellation matters: performance and avoiding wasted work Early .NET approaches: thread aborts and their problems Evolution of async patterns: APM and EPM without cancellation BackgroundWorker and early cancellation mechanisms Composition challenges and the need for a shared token model Introduction of CancellationToken and cooperative cancellation Passing tokens explicitly vs. ambient scopes How cancellation propagates through async methods Leaf operations, registration callbacks, and prompt cancellation CancellationTokenSource: producing and linking tokens Separation of observing vs. requesting cancellation Implementation details: polling, register, and throw helpers Why volatile matters in multi-threaded cancellation checks Lock-free programming, visibility, and compiler optimizations Wrapping up insights on cooperative cancellation in .NET 🔗 Docs: learn.microsoft.com/dotnet/standard/threading/cancellation-i… 🎙️ Featuring: Scott Hanselman and Stephen Toub 📲 Connect with .NET: Blog: aka.ms/dotnet/blog Twitter: aka.ms/dotnet/twitter TikTok: aka.ms/dotnet/tiktok Mastodon: aka.ms/dotnet/mastodon LinkedIn: aka.ms/dotnet/linkedin Facebook: aka.ms/dotnet/facebook Docs: learn.microsoft.com/dotnet Forums: aka.ms/dotnet/forums 🙋♀️Q&A: aka.ms/dotnet-qa 👨🎓Microsoft Learn: aka.ms/learndotnet #dotnetWhy it's here
2 people recommend thisWhat people say. Recommended for its deep dive and clear explanation of cancellation tokens and their history in .NET.
u/cutecupcake11in r/dotnet • Recommends
Another deep.net video from Stephen Toub
link to this video
Tldr:deep.net is a series of YouTube videos from dotnet team, this one talks about cancelationtoken and its history and implementation/best practices.. i am always amazed by Stephens ability to explain with examples..
u/TechTalksWeeklyin r/dotnet • Mentions
.NET Podcasts & Conference Talks (week 50, 2025)
Hi r/dotnet!
As part of Tech Talks Weekly, I'll be posting here every week with all the latest .NET talks and podcasts. To build this list, I'm following over 100 software engineering conferences and even more podcasts. This means you no longer need to scroll through messy YT subscriptions or RSS feeds!
In addition, I'll periodically post compilations, for example a list of the most-watched .NET talks of 2025.
The following list includes all the .NET talks and podcasts published in the past 7 days (2025-12-04 - 2025-12-11).
Let's get started!
# AWS re:Invent 2025
1. [**"AWS re:Invent 2025 - Breaking 25 years of tech debt using AWS Trans…