dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
703 stars 1.55k forks source link

Mixing Tasks and Threads #926

Open softlion opened 5 years ago

softlion commented 5 years ago

This docs mix tasks with threads. A task is not a thread ! 2 different tasks can run in the same thread. It's the TaskScheduler job to determines which Task runs on which thread. Thus this documentation is very confusing. SemaphoreSlim does not lock access to a thread. It locks access to a resource. Which can be of any kind!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

rpetrusha commented 5 years ago

Thanks for your feedback, @softlion. It appears that we retrofitted a threading example to use tasks and did it incompletely. We'll update the example during an upcoming sprint.