dotnet/runtime

ServiceController.WaitForStatus could use NotifyServiceStatusChange WinAPI to avoid polling

Open

#45,049 建立於 2020年11月21日

在 GitHub 查看
 (0 留言) (2 反應) (0 負責人)C# (5,445 fork)batch import
area-System.ServiceProcesshelp wanted

倉庫指標

Star
 (17,886 star)
PR 合併指標
 (平均合併 12天 11小時) (30 天內合併 661 個 PR)

描述

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.

貢獻者指南