Skip to content

ServiceController.WaitForStatus could use NotifyServiceStatusChange WinAPI to avoid polling #45049

Open

Description

@Fs00

Currently, ServiceController WaitForStatus method polls every 250ms to check if the service has reached the desired status.
This is not optimal and also not very performant, particularly if the service takes less than 250ms to reach that status.
Apparently lost in the mists of time, there was a plan to use the WinAPI function NotifyServiceStatusChange to avoid polling and get instantly notified when the service reaches a specific status.

I'm opening this issue to prevent this potential improvement from getting lost again.

Props to @KalleOlaviNiemitalo for finding this.

Activity

  1. added this to the Future milestone on Nov 24, 2020
  2. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 13, 2021
  3. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Mar 31, 2021
  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 8, 2021
  5. added
    help wanted[up-for-grabs] Good issue for external contributors
    on Apr 10, 2022
  6. dotnet-policy-service commented on Oct 19, 2026

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

    This process is part of our issue cleanup automation.

  7. dotnet-policy-service commented on Oct 19, 2026

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

    This process is part of our issue cleanup automation.

  8. Fs00 commented on Oct 25, 2026

    @Fs00
    ContributorAuthor

    This issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions