You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ship a non-reentrant lock around a single call. Bulkhead and rate limiting belong to the Polly behavior. This one only excludes overlapping calls on the stunt.
API
The behavior takes an optional lock object. The default is a private object owned by the behavior, so one behavior locks one stunt.
Behavior
Acquire the lock before next and release it when the attempt finishes. For Task and ValueTask, that is when Proceed finishes awaiting.
The lock is non-reentrant. A second call on the same thread while it is held throws, so a virtual call from a constructor, or from the target, cannot deadlock on this behavior.
Document that constructor logic and the target must not call back into a member locked by this behavior.
Acceptance
Two overlapping calls run one at a time.
The lock is released when a returned task completes, and a later call enters.
A re-entrant call on the same thread throws instead of hanging.
Activity
Add SynchronizedBehavior with non-reentrant lock for #271
kzu commentedon Oct 8, 2026
Fixed in #284