Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the timers created by TimeProvider to communicate if is resettable #83949

Closed
tarekgh opened this issue Mar 26, 2023 · 5 comments
Closed
Assignees
Milestone

Comments

@tarekgh
Copy link
Member

tarekgh commented Mar 26, 2023

This issue is to track address the comment on the PR.

TimeProvider allows creating a timer through the method CreateTimer. The created timer can be used in various places like in CancellationTokenSource which support operations like TryReset. Such operation is supported with the system timer only. This issue track looking at if we need to have such operations work with the custom timers too.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 26, 2023
@ghost
Copy link

ghost commented Mar 26, 2023

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

Issue Details

This issue is to track address the comment on the PR.

TimeProvider allows creating a timer through the method CreateTimer. The created timer can be used in various places like in CancellationTokenSource which support operations like TryReset. Such operation is supported with the system timer only. This issue track looking if we need to have such operations work with the custom timers too..

Author: tarekgh
Assignees: -
Labels:

area-System.Threading

Milestone: -

@tarekgh tarekgh added this to the 8.0.0 milestone Mar 26, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Mar 26, 2023
@tarekgh tarekgh self-assigned this Mar 26, 2023
@tarekgh
Copy link
Member Author

tarekgh commented Mar 26, 2023

CC @stephentoub

@tarekgh
Copy link
Member Author

tarekgh commented Mar 26, 2023

#36617

@stephentoub
Copy link
Member

Right. We should double check, but I expect we could make this work if we add an out bool idle or something like that, which would be set to true iff both timeouts were infinite, the method returns true, and the implementation guarantees that the timer will not fire unless subsequent changes are made, eg there's no pending work item already queued that will invoke the timer's callback.

@tarekgh
Copy link
Member Author

tarekgh commented Apr 4, 2023

We'll watch if we find there will be any demand to support this issue and then we can consider it. Maybe in the future we can expose ITimer.MightHavePendingWork and have the timers implement it properly which can be used to address this issue. Closing it for now.

@tarekgh tarekgh closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants