Friday 30 October 2015

ASP.NET Tips #43 - Make use of the Async await pattern

Starting to introduce use of the Async Await pattern on an established codebase can pose challenges which don't exist when using Async on a new project. If the code already makes use of background threads which do Thread.Sleep(), when you change to using Async methods, make sure you switch from Thread.Sleep() to await Task.Delay() instead. This achieves the same result of suspending that bit of work, but does it in a nonblocking way which can reduce the total resources needed by the application.

No comments :

Post a Comment