Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit dcec2932 authored by Harald Martini's avatar Harald Martini
Browse files

added kernel lock in SImulatorFactory

parent 502cd488
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
public abstract class SimulatorFactory : LoggingObject, ISimulatorFactory
{
private static int _jobNumberCounter;
private static object _kernelLock = new object();
private static IKernel _kernel; //Kernel is only used when the SimulatorFactory is created with the Factory Method.
protected Func<ISimulatorFactory> _followingSimulatorFactoryCreator = null;
......@@ -80,7 +82,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
[Obsolete("Creation of new SimulatorFactories should be done with SimulatorFactoryFactory NInject Factory", false)]
public static ISimulatorFactory CreateSimulatorFactory(ExecutionMode mode, IInputDataProvider dataProvider, IOutputDataWriter writer, IDeclarationReport declarationReport = null, IVTPReport vtpReport=null, bool validate = true)
{
lock (_kernel) {
lock (_kernelLock) {
if (_kernel == null) {
_kernel = new StandardKernel(new VectoNinjectModule());
}
......@@ -119,7 +121,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
public SummaryDataContainer SumData { get; set; }
public abstract IOutputDataWriter ReportWriter { get; protected set; }
public IOutputDataWriter ReportWriter { get; protected set; }
public int JobNumber { get; set; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment