Server Side Async, DEU Bilgisayar Topluluğu Izmir 2. Teknoloji Zirvesi (EN)
* Slide template belongs to MIX 11 conference.
* A few parts of the content have been taken from other presentations (links to those presentations are available at the bottom-right corner for each slide).
{ DoWorkAsync().Wait(); } async Task DoWorkAsync() { await Task.Run(…); Console.WriteLine("Done task"); } 1. DoWorkAsync invoked on the main thread 3. Await captures SynchronizationContext and hooks up a continuation to run when task completes 4. Main thread blocks waiting for DoWorkAsync-returned Task to complete 6. UI thread still blocked waiting for async operation to complete. Deadlock! .ConfigureAwait(false) avoids deadlock. async Task DoWorkAsync() { await Task.Run(…).ConfigureAwait(false); Console.WriteLine("Done task"); } 2. Task.Run schedules work to run on thread pool 5. Task.Run task completes on pool & invokes continuation which Posts back to main thread