private void GamePlay() { Task gameLoop = new Task(() => { while (true) { System.Threading.Thread.Sleep(gameTick); try { var gameList = ProcessPool.Select(b => b.Value).ToList(); var count = gameList.Count; for (var i = 0; i < count; i++) { if (gameList[i].Room.Players.Count <= 0) { continue; } gameList[i].NextTick(); } } catch { } } }); gameLoop.Start(); }
public IRoomProcessUnit GetRoomById(string roomId) { if (ProcessPool.ContainsKey(roomId)) { return(ProcessPool[roomId]); } return(null); }
public override void DoJob() { ProcessPool processPool = new ProcessPool(new TransactionRepository(), new OperationFactory()); processPool.Start(); Thread.Sleep(1000); }
public ProcessPool.Tool AddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch) { var cmd = new StringBuilder(); if (PartName != null) cmd.Append(" -p " + PartName); foreach (var dir in SearchDirs) cmd.Append(" -sd " + dir); foreach (var lib in Libraries) cmd.Append(" -l " + lib); if (RulesFile != null) cmd.Append(" -ur " + RulesFile); if (IntermediateDir != null) cmd.Append(" -dd " + IntermediateDir); cmd.Append(" -nt "); switch (NGOGeneration) { case ENGOGeneration.Off: cmd.Append(" off"); break; case ENGOGeneration.On: cmd.Append(" on"); break; case ENGOGeneration.Timestamp: cmd.Append(" timestamp"); break; } if (UserConstraintsFile != null) cmd.Append(" -uc " + UserConstraintsFile); if (IgnoreLocationConstraints) cmd.Append(" -r"); if (AllowUnmatchedLOCConstraints) cmd.Append(" -aul"); if (AllowUnmatchedTimingGroupConstraints) cmd.Append(" -aut"); if (InferPadComponents) cmd.Append(" -a"); if (IgnoreDefaultUCF) cmd.Append(" -i"); if (AllowUnexpandedBlocks) cmd.Append(" -u"); if (InsertKeepHierarchy) cmd.Append(" -insert_keep_hierarchy"); if (BMMFile != null) cmd.Append(" -bm " + BMMFile); if (FilterFile != null) cmd.Append(" -filter " + FilterFile); cmd.Append(" -intstyle silent"); if (Quiet) cmd.Append(" -quiet"); if (Verbose) cmd.Append(" -verbose"); cmd.Append(" " + DesignName); if (NGDFile != null) cmd.Append(" " + NGDFile); return proj.AddToolToBatch(batch, proj.ProjectPath, "ngdbuild", cmd.ToString()); }
public IRoomProcessUnit NewRoom() { var newRoom = new Room(); newRoom.Id = Guid.NewGuid().ToString(); var unit = new GameUnit(newRoom, monsterPool, gameTick); ProcessPool.Add(newRoom.Id, unit); return(unit); }
public void Start_ProcessPool_RunOperationComplete() { //arrange //act ProcessPool processPool = new ProcessPool(iTransactionRepositoryMock.Object, iOperationFactoryMock.Object); processPool.Start(); //assert CommonVerifyControl(); Assert.That(mscMcomPool.ProcessStatus, Is.EqualTo("C")); }
public void CannotAddSameProcessTwice() { var processManagerPool = new ProcessPool(); var processManager = new Mock <IProcess>(); Assert.Throws <ArgumentException>(() => { processManagerPool.Add(processManager.Object); processManagerPool.Add(processManager.Object); }); }
public void Start_ProcessPool_RunOperationException() { //arrange iOperaionMock.Setup(f => f.Create(It.IsAny <MscMcomPool>())).Throws <Exception>(); //act ProcessPool processPool = new ProcessPool(iTransactionRepositoryMock.Object, iOperationFactoryMock.Object); processPool.Start(); //assert CommonVerifyControl(); Assert.That(mscMcomPool.ProcessStatus, Is.EqualTo("E")); }
public void CannotRemoveSameProcessTwice() { var processManagerPool = new ProcessPool(); var serviceMock = new Mock <IGearshiftService>(); var processManager = new TrailerEngineBrakingDetectionProcess(serviceMock.Object); Assert.Throws <ArgumentException>(() => { processManagerPool.Add(processManager); processManagerPool.Remove(typeof(TrailerEngineBrakingDetectionProcess)); processManagerPool.Remove(typeof(TrailerEngineBrakingDetectionProcess)); }); }
public GitRepo(ITracer tracer, Enlistment enlistment, PhysicalFileSystem fileSystem) { this.tracer = tracer; this.workingDirectoryPath = enlistment.WorkingDirectoryRoot; this.fileSystem = fileSystem; this.GVFSLock = new GVFSLock(tracer); this.batchCheckProcessPool = new ProcessPool <GitCatFileBatchCheckProcess>( tracer, () => new GitCatFileBatchCheckProcess(tracer, enlistment), Environment.ProcessorCount); this.catFileProcessPool = new ProcessPool <GitCatFileBatchProcess>( tracer, () => new GitCatFileBatchProcess(tracer, enlistment), Environment.ProcessorCount); }
public void Dispose() { if (this.catFileProcessPool != null) { this.catFileProcessPool.Dispose(); this.catFileProcessPool = null; } if (this.batchCheckProcessPool != null) { this.batchCheckProcessPool.Dispose(); this.batchCheckProcessPool = null; } if (this.GVFSLock != null) { this.GVFSLock.Dispose(); this.GVFSLock = null; } }
public FindMissingBlobsJob( int maxParallel, BlockingCollection <string> inputQueue, BlockingCollection <string> availableBlobs, ITracer tracer, Enlistment enlistment) : base(maxParallel) { this.tracer = tracer.StartActivity(AreaPath, EventLevel.Informational); this.inputQueue = inputQueue; this.enlistment = enlistment; this.alreadyFoundBlobIds = new ConcurrentHashSet <string>(); this.DownloadQueue = new BlockingCollection <string>(); this.AvailableBlobs = availableBlobs; this.catFilePool = new ProcessPool <GitCatFileBatchCheckProcess>( tracer, () => new GitCatFileBatchCheckProcess(this.tracer, this.enlistment), maxParallel); }
public ProcessPool.Tool SaveToXSTScriptAndAddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch, string scriptPath, string logPath) { SaveToXSTScript(scriptPath); return AddToBatch(proj, batch, scriptPath, logPath); }
public static ProcessPool.Tool AddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch, string scriptPath, string logPath) { string args = "-intstyle \"silent\" -ifn \"" + scriptPath + "\" -ofn \"" + logPath + "\""; return proj.AddToolToBatch(batch, proj.ProjectPath, "xst", args); }
static AbstractDownLoader() { processPool = new ProcessPool <WebSiteInfo>(Arguments.TIMEOUT + 500); }
public ProcessPool.Tool AddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch) { var cmd = new StringBuilder(); cmd.Append("-ol \"" + PropEnum.ToString(OverallEffortLevel, EPropAssoc.PAR) + "\""); #if false //FIXME: Supporting device families? cmd.Append(" -pl \"" + PropEnum.ToString(PlacerEffortLevel, EPropAssoc.PAR) + "\""); cmd.Append(" -rl \"" + PropEnum.ToString(RouterEffortLevel, EPropAssoc.PAR) + "\""); #endif if (ExtraEffortLevel != EExtraEffortLevel.None) cmd.Append(" -xl \"" + PropEnum.ToString(ExtraEffortLevel, EPropAssoc.PAR) + "\""); if (MultiThreading > 1) cmd.Append(" -mt \"" + MultiThreading + "\""); #if false //FIXME: Supporting device families? cmd.Append(" -t \"" + PlacerCostTableEntry + "\""); #endif if (KeepCurrentPlacement) cmd.Append(" -p"); if (ReentrantRoute) cmd.Append(" -k"); if (DontRunRouter) cmd.Append(" -r"); if (Overwrite) cmd.Append(" -w"); if (SmartGuideFile != null) cmd.Append(" -smartguide \"" + SmartGuideFile + "\""); if (IgnoreUserTimingConstraintsAutoGen) cmd.Append(" -x"); if (NoPadReport) cmd.Append(" -nopad"); cmd.Append(" -power \"" + PropEnum.ToString(PowerReduction, EPropAssoc.PAR) + "\""); if (PowerActivityFile != null) cmd.Append(" -activityfile \"" + PowerActivityFile + "\""); if (FilterFile != null) cmd.Append(" -filter \"" + FilterFile + "\""); if (IgnoreUserTimingConstraintsNoGen) cmd.Append(" -ntd"); cmd.Append(" -intstyle silent"); if (ISERepositoryFile != null) cmd.Append(" -ise \"" + ISERepositoryFile + "\""); if (FilterFile != null) cmd.Append(" -filter \"" + FilterFile + "\""); cmd.Append(" \"" + InputFile + "\""); cmd.Append(" \"" + OutputFile + "\""); if (PhysicalConstraintsFile != null) cmd.Append(" \"" + PhysicalConstraintsFile + "\""); return proj.AddToolToBatch(batch, proj.ProjectPath, "par", cmd.ToString()); batch.Add(proj.ISEBinPath, proj.ProjectPath, "par", cmd.ToString()); }
public ProcessPool.Tool AddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch) { var cmd = new StringBuilder(); if (PartName != null) cmd.Append("-p " + PartName); cmd.Append(" -ol \"" + PropEnum.ToString(PlacerEffort, EPropAssoc.MAP) + "\""); if (PlacerExtraEffort != EPlacerExtraEffortMap.None) throw new NotImplementedException(); cmd.Append(" -t " + StartingPlacerCostTable); cmd.Append(" -logic_opt "); if (CombinatorialLogicOptimization) cmd.Append("\"on\""); else cmd.Append("\"off\""); cmd.Append(" -register_duplication "); cmd.Append("\"" + PropEnum.ToString(RegisterDuplication, EPropAssoc.MAP) + "\""); cmd.Append(" -global_opt \"" + PropEnum.ToString(GlobalOptimization, EPropAssoc.MAP) + "\""); cmd.Append(" -equivalent_register_removal "); if (EquivalentRegisterRemoval) cmd.Append("\"on\""); else cmd.Append("\"off\""); if (IgnoreUserTimingConstraints) cmd.Append(" -x"); if (TrimUnconnectedSignals) cmd.Append(" -u"); if (IgnoreKeepHierarchy) cmd.Append(" -ignore_keep_hierarchy"); #if false //FIXME: Which architectures allow for this property? cmd.Append(" -cm \"" + PropEnum.ToString(OptimizationStrategyCoverMode, EPropAssoc.MAP) + "\""); #endif if (GenerateDetailedMapReport) cmd.Append(" -detail"); cmd.Append(" -ir \"" + PropEnum.ToString(UseRLOCConstraints, EPropAssoc.MAP) + "\""); cmd.Append(" -pr \"" + PropEnum.ToString(PackIORegistersIntoIOBs, EPropAssoc.MAP) + "\""); if (MaximumCompression) cmd.Append(" -c"); cmd.Append(" -lc \"" + PropEnum.ToString(LUTCombining, EPropAssoc.MAP) + "\""); if (MapSliceLogicIntoUnusedBlockRAMs) cmd.Append(" -bp"); cmd.Append(" -power "); if (PowerReduction) cmd.Append("\"on\""); else cmd.Append("\"off\""); if (PowerActivityFile != null) cmd.Append(" -activityfile \"" + PowerActivityFile + "\""); cmd.Append(" -mt \"" + MultiThreading + "\""); if (Overwrite) cmd.Append(" -w"); if (OutputFile != null) cmd.Append(" -o \"" + OutputFile + "\""); cmd.Append(" \"" + InputFile + "\""); if (PRFFile != null) cmd.Append(" " + PRFFile); return proj.AddToolToBatch(batch, proj.ProjectPath, "map", cmd.ToString()); }
public ProcessPool.Tool AddToBatch(XilinxProject proj, ProcessPool.ToolBatch batch) { var cmd = new StringBuilder(); if (VerboseReport || ErrorReport) { if (VerboseReport) cmd.Append("-v "); else cmd.Append("-e "); cmd.Append(ReportLimit); } if (TimingReport) { cmd.Append(" -l " + TimingReportLimit); } if (ReportPathsPerEndpoint) { cmd.Append(" -n " + EndpointsLimit); } if (SpeedGrade > 0) { cmd.Append(" -s " + SpeedGrade); } if (AdvancedAnalysis) { cmd.Append(" -a"); } if (ReportUnconstrainedPaths) { cmd.Append(" -u " + UnconstrainedPathsLimit); } if (ReportFile != null) { cmd.Append(" -o \"" + ReportFile + "\""); } if (StampFile != null) { cmd.Append(" -stamp \"" + StampFile + "\""); } if (TSIFile != null) { cmd.Append(" -tsi \"" + TSIFile + "\""); } if (XMLReportFile != null) { cmd.Append(" -xml \"" + XMLReportFile + "\""); } if (NoDatasheet) { cmd.Append(" -nodatasheet"); } if (TimegroupsSection) { cmd.Append(" -timegroups"); } if (ReportFastestPaths) { cmd.Append(" -fastpaths"); } if (FilterFile != null) { cmd.Append(" -filter \"" + FilterFile + "\""); } if (TurnOffPackageFlightDelay) { cmd.Append(" -noflight"); } cmd.Append(" -intstyle silent"); if (ISEProjectFile != null) { cmd.Append(" -ise \"" + ISEProjectFile + "\""); } cmd.Append(" \"" + PhysicalDesignFile + "\""); if (PhysicalConstraintsFile != null) cmd.Append(" \"" + PhysicalConstraintsFile + "\""); if (UserConstraintsFile != null) cmd.Append(" -ucf \"" + UserConstraintsFile + "\""); return proj.AddToolToBatch(batch, proj.ProjectPath, "trce", cmd.ToString()); }