-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lock to scoped burdens to ensure only one instance is created per scope #547
Conversation
@jonorossi can you add netfore3 and 3.1 to the appveyor? Then the tests can run in all frameworks |
…n 1 instance on mulitple threads castleproject#533
@AntonioDrusin can you review. it was the scopeCache that needed the lock. Hence we only sync for each scope. less performance hit, and more SOLID as scopeCache is an instance, not a static.. lock (scopeCache)
{
var burden = scopeCache[model];
if (burden == null)
{
scopeCache[model] = burden = createInstance((_) => {});
}
return burden;
} |
...ensions.DependencyInjection.Tests/Castle.Windsor.Extensions.DependencyInjection.Tests.csproj
Outdated
Show resolved
Hide resolved
src/Castle.Windsor.Extensions.DependencyInjection/Scope/ExtensionContainerScope.cs
Outdated
Show resolved
Hide resolved
The lock code looks correct. I tested with @mdavis test project and with my own. The resolvers now behave as expected. |
src/Castle.Windsor.Extensions.DependencyInjection/Scope/ExtensionContainerScope.cs
Outdated
Show resolved
Hide resolved
@jonorossi improved nestling and improved naming of variables for readability |
@jonorossi did i get all the review comments ok? If so, can we get this into master and a new build for people? |
@generik0 yep, all good. Merged to master. |
Add lock to scoped burdens to ensure only one instance is created per scope
#533