Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thinktecture Webinar async/await in .NET

Thinktecture Webinar async/await in .NET

Slides for my webinar about async/await in .NET.

Sebastian Gingter

August 31, 2021
Tweet

More Decks by Sebastian Gingter

Other Decks in Programming

Transcript

  1. 3 ▪ ▪ ▪ (Theorie 😨) ▪ ▪ ▪ Deep-dive

    in async/await bei Backend-APIs
  2. 14 Deep-dive in async/await bei Backend-APIs Task Task-Liste Threadpool T1

    Threadpool T2 Kern 1 Kern 3 Kern 2 Kern 4 Threadpool T3 Threadpool T4 Threadpool Management Jeder Pool-Thread arbeitet Tasks in einer Endlosschleife ab Completed Tasks
  3. 17 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ▪

    ▪ Deep-dive in async/await bei Backend-APIs ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
  4. 18 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ Deep-dive

    in async/await bei Backend-APIs ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
  5. 20 • • async Task<> MyMethodAsync() • • • await

    OtherMethodAsync() • • await • • • • Deep-dive in async/await bei Backend-APIs
  6. 23 • • task.GetAwaiter().GetResult() → ❌ • Thread.Sleep() → ❌

    • await Task.Delay() → ✔ • Thread.SpinWait() • → ❌ • → ✔ Deep-dive in async/await bei Backend-APIs
  7. 24 • • var task1 = DoSomethingAsync(); var task2 =

    DoSomethingElseAsync(); await Task.WhenAll(task1, task2); • • • Task.Factory.StartNew(…, TaskCreationOptions.LongRunning); • • • Deep-dive in async/await bei Backend-APIs