Skip to content

Fix infinite timeout passed to CancellationTokenSource.CancelAfter#84009

Merged
stephentoub merged 1 commit into
dotnet:mainfrom
stephentoub:fixctstimeout
Mar 28, 2023
Merged

Fix infinite timeout passed to CancellationTokenSource.CancelAfter#84009
stephentoub merged 1 commit into
dotnet:mainfrom
stephentoub:fixctstimeout

Conversation

@stephentoub

Copy link
Copy Markdown
Member

The recent change to introduce ITimer broke CTS.CancelAfter(Timeout.InfiniteTimeSpan). The TimeSpan's milliseconds were extracted as a uint but then ended up being cast to a long, such that rather than representing -1 milliseconds, it represented 4294967295 milliseconds. With the uint representation in Timer, Timeout.UnsignedInfinite needs to be special-cased.

aspnet/Benchmarks#1822

The recent change to introduce ITimer broke CTS.CancelAfter(Timeout.InfiniteTimeSpan).  The TimeSpan's milliseconds were extracted as a uint but then ended up being cast to a long, such that rather than representing -1 milliseconds, it represented 4294967295 milliseconds.  With the uint representation in Timer, Timeout.UnsignedInfinite needs to be special-cased.
@stephentoub stephentoub requested a review from tarekgh March 28, 2023 02:09
@ghost ghost assigned stephentoub Mar 28, 2023
@ghost

ghost commented Mar 28, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Issue Details

The recent change to introduce ITimer broke CTS.CancelAfter(Timeout.InfiniteTimeSpan). The TimeSpan's milliseconds were extracted as a uint but then ended up being cast to a long, such that rather than representing -1 milliseconds, it represented 4294967295 milliseconds. With the uint representation in Timer, Timeout.UnsignedInfinite needs to be special-cased.

aspnet/Benchmarks#1822

Author: stephentoub
Assignees: stephentoub
Labels:

area-System.Threading

Milestone: -

@IDisposable IDisposable left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@stephentoub stephentoub merged commit 3231e4f into dotnet:main Mar 28, 2023
@stephentoub stephentoub deleted the fixctstimeout branch March 28, 2023 10:24
@ghost ghost locked as resolved and limited conversation to collaborators Apr 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants