public static void FreeProcessor(RemoteProcessor processor) { lock (typeof(RemoteProcessorsManager)) { BusyProcessors.Remove(processor); FreeProcessors.Add(processor); } }
public static void FreeProcessor(RemoteProcessor processor) { lock(typeof(RemoteProcessorsManager)) { BusyProcessors.Remove(processor); FreeProcessors.Add(processor); } }
public static RemoteProcessor PopProcessor() { lock (typeof(RemoteProcessorsManager)){ RemoteProcessor tmp = (RemoteProcessor)FreeProcessors[FreeProcessors.Count - 1]; FreeProcessors.Remove(tmp); BusyProcessors.Add(tmp); return(tmp); } }
public static void CloseProcessor(RemoteProcessor processor) { if (FreeProcessors.Contains(processor)) { FreeProcessors.Remove(processor); } if (BusyProcessors.Contains(processor)) { BusyProcessors.Remove(processor); } }
private void LoadProcessorsAndConfigurations() { XmlDocument cfg = new XmlDocument(); cfg.Load(Loader.apppath + @"\config.xml"); matrixmemsize = int.Parse(cfg.SelectSingleNode("Configurations/MatrixMemorySize").InnerText); threadstacksize = int.Parse(cfg.SelectSingleNode("Configurations/ThreadStackSize").InnerText); //*********************Loading Processors************ XmlNodeList nlist = cfg.SelectNodes("Configurations/RemoteProcessor"); Console.WriteLine("Loading RemoteProcessors"); foreach (XmlNode tmp in nlist) { try { RemoteProcessor tmpprocessor = new RemoteProcessor(); string ipaddr = tmp.SelectSingleNode("IPAddress").InnerText; int prt = int.Parse(tmp.SelectSingleNode("Port").InnerText); Console.WriteLine("Connecting to {0}:{1}....", ipaddr, prt); tmpprocessor.Connect(ipaddr, prt); tmpprocessor.StartProcessor(); tmpprocessor.localprocessor = localprocessor; RemoteProcessorsManager.AddProcessor(tmpprocessor); } catch (Exception exc) { Console.WriteLine(exc.Message); } } //*********************Loading External Devices************ nlist = cfg.SelectNodes("Configurations/ExternalDevice"); if (nlist.Count > 0) { Console.WriteLine("Loading External Devices"); externaldevices = new ExternalDevicePort[nlist.Count]; int tmp2 = 0; foreach (XmlNode tmp in nlist) { externaldevices[tmp2] = new ExternalDevicePort( tmp.SelectSingleNode("Name").InnerText , new ExternalDevicePort.Echo(this.EchoMessage)); externaldevices[tmp2].Initialize(int.Parse( tmp.SelectSingleNode("Port").InnerText)); tmp2++; } } }
private void LoadProcessorsAndConfigurations() { XmlDocument cfg = new XmlDocument(); cfg.Load(Loader.apppath + @"\config.xml"); matrixmemsize = int.Parse(cfg.SelectSingleNode("Configurations/MatrixMemorySize").InnerText); threadstacksize = int.Parse(cfg.SelectSingleNode("Configurations/ThreadStackSize").InnerText); //*********************Loading Processors************ XmlNodeList nlist = cfg.SelectNodes("Configurations/RemoteProcessor"); Console.WriteLine("Loading RemoteProcessors"); foreach(XmlNode tmp in nlist){ try { RemoteProcessor tmpprocessor = new RemoteProcessor(); string ipaddr = tmp.SelectSingleNode("IPAddress").InnerText; int prt = int.Parse(tmp.SelectSingleNode("Port").InnerText); Console.WriteLine("Connecting to {0}:{1}....",ipaddr,prt); tmpprocessor.Connect(ipaddr,prt); tmpprocessor.StartProcessor(); tmpprocessor.localprocessor = localprocessor; RemoteProcessorsManager.AddProcessor(tmpprocessor); } catch(Exception exc){ Console.WriteLine(exc.Message); } } //*********************Loading External Devices************ nlist = cfg.SelectNodes("Configurations/ExternalDevice"); if(nlist.Count>0) { Console.WriteLine("Loading External Devices"); externaldevices = new ExternalDevicePort[nlist.Count]; int tmp2=0; foreach(XmlNode tmp in nlist) { externaldevices[tmp2] = new ExternalDevicePort( tmp.SelectSingleNode("Name").InnerText ,new ExternalDevicePort.Echo(this.EchoMessage)); externaldevices[tmp2].Initialize(int.Parse( tmp.SelectSingleNode("Port").InnerText)); tmp2++; } } }
public static void CloseProcessor(RemoteProcessor processor) { if(FreeProcessors.Contains(processor))FreeProcessors.Remove(processor); if(BusyProcessors.Contains(processor))BusyProcessors.Remove(processor); }
public static void AddProcessor(RemoteProcessor processor) { FreeProcessors.Add(processor); }