Skip to content

Commit

Permalink
add more links
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Oct 29, 2024
1 parent 634ab2c commit 104fa19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rules/S7131/csharp/rule.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

When using https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlock[ReaderWriterLock] and https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlockslim[ReaderWriterLockSlim] for managing read and write locks, you should not exit a read lock while holding a write lock otherwise you might have unexpected behavior.
The locks should be always correctly paired so that the shared resource is accessed safely.

This rule raises if you acquire https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlock.acquirewriterlock[ReaderWriterLock.AcquireWriterLock] or https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlock.upgradetowriterlock[ReaderWriterLock.UpgradeToWriterLock] and then use https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlock.releasereaderlock[ReaderWriterLock.ReleaseReaderLock] before releasing the writerlock or
when you acquire https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlockslim.enterwritelock[ReaderWriterLockSlim.EnterWriteLock] or https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlockslim.tryenterwritelock[ReaderWriterLockSlim.TryEnterWriteLock] and then use https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlockslim.exitreadlock[ReaderWriterLockSlim.ExitReadLock] before you release it.


== Why is this an issue?
Expand Down

0 comments on commit 104fa19

Please sign in to comment.