dotnet / dotnet/docs

The topic needs a bit more detail on some aspects of lock state transition

Open
#51,205 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

### Type of issue

Missing information

### Description

The article glosses over one detail of the lock behaviour that seems to be implied by the code examples (which are rather long and thus difficult to parse), but not directly stated.

If you enter the lock in Upgradable Read mode, and then upgrade to Write mode, you then have *both* an upgradable-read *and* a write lock, and need to exit *both*. This should be made clear, as it is possible to assume that if you enter in Upgradable Read, then upgrade to Write, you now just have a write lock and only need to exit that.

It is a minor point, but stating it clearly would help avoid confusion for users who are first encountering a ReaderWriterLockSlim.

### Page URL

https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-threading-readerwriterlockslim

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/fundamentals/runtime-libraries/system-threading-readerwriterlockslim.md

### Document Version Independent Id

6f0202ff-800c-34a3-7634-c0652cfc2f62

### Platform Id

8af8b763-311e-16d0-6a38-4a0425f2b1dd

### Article author

@gewarren

### Metadata

* ID: 7b09b817-86df-eeca-bfe3-12605cf893bc
* PlatformId: 8af8b763-311e-16d0-6a38-4a0425f2b1dd
* Service: **dotnet-fundamentals**

[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+6f0202ff-800c-34a3-7634-c0652cfc2f62)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.