public View(IKeyTableFactory tableFactory, IAsynchQueueFactory queueFactory, IPrimFactory primFactory, IConfigSource config) : base(tableFactory, queueFactory) { _factory = primFactory; _displayingBoards = tableFactory.MakeKeyTable <IEnumerable <UUID> >(); _moveQ = queueFactory.MakeQueue(); _deliverQ = queueFactory.MakeQueue(); //_moveQ = new SmartThreadPool(int.MaxValue, 30, 3); IConfig viewConfig = config.Configs["View"]; if (viewConfig == null) { viewConfig = config.Configs[0]; } _wait = viewConfig.GetInt("Wait", _wait); _waitMultiplier = viewConfig.GetFloat("WaitMultiplier", 5f); _displayChannel = viewConfig.GetInt("ListeningChannel", -43); _autoUpdate = viewConfig.GetBoolean("AutoUpdateTables", false); int tableResolution = viewConfig.GetInt("TableResolution", -1); if (tableResolution > 0) { VNode.SetTableResolution(tableResolution); } _moveQ.Start("View Move Queue" /*, viewConfig.GetInt("PacketsPerThread", PACKETS_PER_THREAD)*/); _deliverQ.Start("View Deliver Queue"); //_moveQ.Start(); VLink.MaxWidth = viewConfig.GetFloat("maxLinkWidth", VLink.MaxWidth); VLink.MinWidth = viewConfig.GetFloat("minLinkWidth", VLink.MinWidth); VPacket.MaxMovesPerUnit = viewConfig.GetInt("maxNumPacketMovesPerUnit", VPacket.MaxMovesPerUnit); VPacket.MinMovesPerUnit = viewConfig.GetInt("minNumPacketMovesPerUnit", VPacket.MinMovesPerUnit); VPacket.DefaultMovesPerUnit = viewConfig.GetInt("defaultNumPacketMovesPerUnit", VPacket.DefaultMovesPerUnit); _tickThread = new Thread(() => { _cont = true; int wait = (int)(Wait * _waitMultiplier); int tick = 0; while (_cont) { Util.Wait(wait, _cont && wait > 0, this); DateTime start = DateTime.Now; if (_cont && OnTick != null) { OnTick(); } wait = (int)((Wait * _waitMultiplier) - DateTime.Now.Subtract(start).TotalMilliseconds); tick++; } }); _tickThread.Name = "View Tick Thread"; _tickThread.Start(); Logger.Info("View started."); }