dotnet/runtime

ServiceController.WaitForStatus could use NotifyServiceStatusChange WinAPI to avoid polling

オープン

#45,049 opened on 2020/11/21

 (0 件のコメント) (2 件のリアクション) (0 人の担当者)C# (5,445 件のフォーク)batch import
area-System.ServiceProcesshelp wanted

Repository metrics

Stars
 (17,886 個のスター)
PR merge metrics
 (平均マージ 12d 11h) (30d で 661 merged PRs)

説明

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.

コントリビューターガイド