LockRecursionPolicy Enum
Specifies whether to allow re-entrant locking. This enumeration is used by the LockSynchronization class.
Members
Remarks
The LockRecursionPolicy enumeration is used to configure the behavior of re-entrant locking in the LockSynchronization class. This policy determines how the system handles situations where a thread tries to acquire a lock that it already holds.
When LockRecursionPolicy.NoRecursion is specified, attempting to re-acquire a held lock will result in a LockSynchronizationException. This is the default behavior and helps prevent potential deadlocks in scenarios where re-entrant locking is not intended.
Conversely, when LockRecursionPolicy.RecursionAllowed is set, a thread can acquire the same lock multiple times. This can be useful in complex hierarchical locking scenarios, but it requires careful management to avoid infinite recursion or other concurrency issues.
Syntax
public enum LockRecursionPolicy