diff --git a/analyzers/rspec/cs/S2551.html b/analyzers/rspec/cs/S2551.html index 520581969fb..c553d9fe975 100644 --- a/analyzers/rspec/cs/S2551.html +++ b/analyzers/rspec/cs/S2551.html @@ -1,14 +1,15 @@

Why is this an issue?

A shared resource refers to a resource or data that can be accessed or modified by multiple threads or concurrent parts of a program. It could be any piece of data, object, file, -database connection, or system resource that needs to be accessed or manipulated by multiple parts of a program concurrently.

-

Shared resources should not be used for locking as it increases the chance of -deadlocks. Any other thread could acquire (or attempt to acquire) the same lock while doing some -operation, without knowing that the resource is meant to be used for locking purposes.

-

One example of this is a String interned by the runtime. This -means that each String instance is immutable and stored, and then reused everywhere it is referenced.

-

Instead, a dedicated private object instance should be used for each shared resource. Making the lock-specific object -private guarantees that the access to it is as minimal as possible, in order to avoid deadlocks or lock contention.

+database connection, or system resource that needs to be accessed or manipulated by multiple parts of a program at the same time.

+

Shared resources should not be used for locking because it increases the chance +of deadlocks. Any other thread could acquire (or attempt to acquire) the same lock while doing +some operation, without knowing that the resource is meant to be used for locking purposes.

+

For example, a string should never be used for locking. When a string is interned by the runtime, it can be shared by multiple threads, breaking the +locking mechanism.

+

Instead, a dedicated private object instance should be used for each shared resource. This minimizes access to the lock instance, +avoiding deadlocks and lock contention.

The following objects are considered as shared resources: