Пример #1
0
        /// <inheritdoc />
        ///  <summary>
        ///  </summary>
        ///  <param name="id"></param>
        ///  <param name="log"></param>
        ///  <param name="repository"></param>
        /// <param name="luaProxy"></param>
        public LuaVirtualMachine(long id, ILogWrapper log, LuaFunctionRepository repository, LuaInterfaceProxy luaProxy)
            : base(id, "LuaVirtualMachine" + id)
        {
            if (id < 1)
            {
                throw new ArgumentOutOfRangeException();
            }

            _tasks      = new Dictionary <Task, CancellationTokenSource>();
            _log        = log;
            _repository = repository;
            _luaProxy   = luaProxy;
        }
Пример #2
0
        /// <inheritdoc />
        /// <summary>
        /// Constructor
        /// </summary>
        public LuaVirtualMachineContext(ILogWrapper log, int numberVirtualMachines, LuaFunctionRepository repository)
            : base(1, "LuaVirtualMachineContext")
        {
            Validation.IsNotNull(log, "log");
            Validation.Validate <ArgumentOutOfRangeException>(numberVirtualMachines > 0);
            Validation.IsNotNull(repository, "repository");

            _repository = repository;
            var proxy = new LuaInterfaceProxy();

            Enumerable.Range(0, numberVirtualMachines)
            .ToList()
            .ForEach(i => _virtualMachines.Enqueue(new LuaVirtualMachine(i + 1, log, repository, proxy)));
        }