Repository navigation
Conversation
kzu
force-pushed
the
synchronized-behavior-271
branch
from
October 8, 2026 00:11
e785b26 to
97ed19d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #271.
SynchronizedBehavior Design
Summary
Adds
SynchronizedBehavior, anIStuntBehaviorthat serializes overlapping calls on a stunt using a standardobjectlock (normallockstatement semantics, reentrant).This follows the normal pattern used by Castle DynamicProxy interceptors and .NET in general:
lock (syncRoot) { next(); }. No custom lock types, no shared tables.API
syncRoot: optional lock object. Default is a private object owned by the behavior, so one behavior locks one stunt. Passing an explicit object lets multiple behaviors coordinate on the same lock (standardlocksemantics).ICloneablesoBehaviorPipeline.Materializegives each stunt its own lock by default; an explicit lock object stays shared across clones.Behavior
flowchart TD A[Execute] --> B[lock syncRoot] B --> C[next invocation] C --> D[return IMethodReturn]Simple: acquire the lock, invoke
next, release. Reentrant (same thread can re-enter, likeMonitor).Acceptance tests (scenarios)
Files
src/Stunts/SynchronizedBehavior.cs(new)src/Stunts.UnitTests/Scenarios/Synchronized.cs(new)Notes
Deviates from the original issue text (which specified non-reentrant): per discussion, we follow the normal .NET/Castle
locksemantics (reentrantMonitor).