Fix rare cleanup race condition in Task.Delay (#46631)
authorStephen Toub <stoub@microsoft.com>
Wed, 6 Jan 2021 21:48:02 +0000 (16:48 -0500)
committerGitHub <noreply@github.com>
Wed, 6 Jan 2021 21:48:02 +0000 (16:48 -0500)
commit2233b6486a87e178582507e9724a3a6ce3e2d823
treecbcd50ecfe7346e6bfe36d503de926d44edf81b5
parent600c3763e813845474b3e0db748d83c2496fd399
Fix rare cleanup race condition in Task.Delay (#46631)

If both a timeout and a cancelable token are provided, and if the timer manages to fire between the time that it's created and the time that we register with the cancellation token immediately after, we will end up leaking a registration into the token.
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs