microsoft/PowerToys

Replace Thread.Sleep with task.Delay

Open

#7,427 opened on Oct 20, 2020

View on GitHub
 (2 comments) (2 reactions) (0 assignees)C# (7,978 forks)batch import
Area-QualityArea-TestsCost-SmallHelp WantedProduct-Color PickerProduct-PowerToys Run

Repository metrics

Stars
 (133,154 stars)
PR merge metrics
 (Avg merge 14d 20h) (117 merged PRs in 30d)

Description

Performance Improvement of PT Run

Similar to PR #7401, replacing Thread.Sleep with Task.Delay throughout the codebase would improve the performance of PT Run as Thread.Sleep blocks the thread that it is called on whereas Task.Delay uses a timer instead and schedules a thread to resume work after the interval has passed. This does not block the thread.

Contributor guide