Исходный код вики Сценарии
Редактировал(а) Alexandr Fokin 2024/12/11 13:34
Последние авторы
| author | version | line-number | content |
|---|---|---|---|
| 1 | |(% style="width:399px" %)[[Имитация Async Deadlock>>doc:Разработка.NET.C#.Многопоточность и асинхронность.Сценарии.Имитация асинхронного (Async) Deadlock.WebHome]]|(% style="width:1094px" %) | ||
| 2 | |(% style="width:399px" %)[[Параллельность и асинхронность>>doc:.Параллельность и асинхронность.WebHome]]|(% style="width:1094px" %) | ||
| 3 | |(% style="width:399px" %)[[Пакетная обработка заявок с асинхронностью (Async)>>doc:.Пакетная обработка заявок с асинхронностью (Async).WebHome]]|(% style="width:1094px" %) | ||
| 4 | |(% style="width:399px" %)CancellationTokenSource CreateLinkedTokenSource|(% style="width:1094px" %)((( | ||
| 5 | When to dispose CancellationTokenSource? | ||
| 6 | [[https:~~/~~/stackoverflow.com/questions/6960520/when-to-dispose-cancellationtokensource>>https://stackoverflow.com/questions/6960520/when-to-dispose-cancellationtokensource]] | ||
| 7 | |||
| 8 | {{code language="c#"}} | ||
| 9 | using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(extraToken) | ||
| 10 | {{/code}} | ||
| 11 | ))) | ||
| 12 | |(% style="width:399px" %){{code language="C#"}}Task.Yield(){{/code}}|(% style="width:1094px" %)((( | ||
| 13 | When would I use Task.Yield()? | ||
| 14 | [[https:~~/~~/stackoverflow.com/questions/22645024/when-would-i-use-task-yield>>https://stackoverflow.com/questions/22645024/when-would-i-use-task-yield]] | ||
| 15 | |||
| 16 | Async, recursion, and some weirdness in design of asynchronous API in C# | ||
| 17 | [[https:~~/~~/alexyakunin.medium.com/async-recursion-and-some-weirdness-of-design-of-asynchronous-api-in-c-vs-f-a5760a00a26a>>https://alexyakunin.medium.com/async-recursion-and-some-weirdness-of-design-of-asynchronous-api-in-c-vs-f-a5760a00a26a]] | ||
| 18 | |||
| 19 | Настройка приостановки и возобновления с помощью Yield и ConfigureAwait | ||
| 20 | [[https:~~/~~/learn.microsoft.com/ru-ru/dotnet/standard/asynchronous-programming-patterns/consuming-the-task-based-asynchronous-pattern#configuring-suspension-and-resumption-with-yield-and-configureawait>>https://learn.microsoft.com/ru-ru/dotnet/standard/asynchronous-programming-patterns/consuming-the-task-based-asynchronous-pattern#configuring-suspension-and-resumption-with-yield-and-configureawait]] | ||
| 21 | |||
| 22 | Task.Yield() in library needs ConfigureWait(false) | ||
| 23 | [[https:~~/~~/stackoverflow.com/questions/28309185/task-yield-in-library-needs-configurewaitfalse>>https://stackoverflow.com/questions/28309185/task-yield-in-library-needs-configurewaitfalse]] | ||
| 24 | ))) | ||
| 25 | |(% style="width:399px" %)Задать размер стека для потока.|(% style="width:1094px" %)((( | ||
| 26 | Можно задать через параметр конструктора потока. | ||
| 27 | Можно использовать для удобного тестирования логики (например рекурсии), которая может вызвать переполнение. | ||
| 28 | |||
| 29 | RuntimeHelpers.TryEnsureSufficientExecutionStack Метод | ||
| 30 | [[https:~~/~~/learn.microsoft.com/ru-ru/dotnet/api/system.runtime.compilerservices.runtimehelpers.tryensuresufficientexecutionstack?view=netcore-3.0>>https://learn.microsoft.com/ru-ru/dotnet/api/system.runtime.compilerservices.runtimehelpers.tryensuresufficientexecutionstack?view=netcore-3.0]] | ||
| 31 | |||
| 32 | Why is stack size in C# exactly 1 MB? | ||
| 33 | [[https:~~/~~/stackoverflow.com/questions/28656872/why-is-stack-size-in-c-sharp-exactly-1-mb>>https://stackoverflow.com/questions/28656872/why-is-stack-size-in-c-sharp-exactly-1-mb]] | ||
| 34 | ))) |