dotnet / dotnet/dotnet-api-docs
Race condition in sample code
Open
area-System.Threading
Pri3
untriaged
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Here we have the code like this:
https://github.com/dotnet/dotnet-api-docs/blob/546ce8963d1c1164c798ab469b3dfbd0f0803a65/snippets/csharp/System.Threading/SemaphoreSlim/Overview/example.cs#L53-L55
Isn't that a race condition? It could happen that once the semaphore is released, the count can change right away by other threads?
Contributor guide
Assessment
This issue has not been assessed yet.