private async Task BuildVillages() { BuildWorker BW = new BuildWorker(); List <Village> villgs = await BW.BuildVillages(Villages); Villages = villgs; UpdateVillageList(Villages); // is good here? }
BuildWorker GetFreeWorker() { lock (freeWorkers) { if (freeWorkers.Count != 0) { BuildWorker w = freeWorkers[freeWorkers.Count - 1]; freeWorkers.RemoveAt(freeWorkers.Count - 1); w.MarkAsInUse(); return(w); } } return(new BuildWorker(this)); }
public void RunBuildJob(BuildJob job, IMSBuildChainedLoggerFilter loggerChain, Action <bool> reportWhenDone, CancellationToken cancellationToken) { if (job == null) { throw new ArgumentNullException("job"); } if (loggerChain == null) { throw new ArgumentNullException("loggerChain"); } BuildWorker worker = GetFreeWorker(); worker.RunJob(job, loggerChain, reportWhenDone, cancellationToken); }