Summary
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.


Summary
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
nextand release it when the attempt finishes. ForTaskandValueTask, that is whenProceedfinishes awaiting.Acceptance