Skip to content

TimerQueueTimer: potentially unnecessary volatile modifier on the private fields #43972

@WizardBrony

Description

@WizardBrony

private volatile bool _canceled;
private volatile object? _notifyWhenNoCallbacksRunning; // may be either WaitHandle or Task<bool>

The field _canceled is only ever referenced inside of a lock, and _notifyWhenNoCallbacksRunning is only read outside of a lock after any concurrency should be possible. So unless there is some logic in another partial class TimerQueueTimer that makes it necessary, I don't see why volatile on these fields is needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions