private void processPendingServices() { while (!m_pendingService.IsEmpty) { TSource svc = null; var gotService = m_pendingService.TryDequeue(out svc); if (gotService && svc != null) { log.info($"Starting service {svc}"); Imm.AddOrUpdate(ref m_services, svc.id, svc, (k, v) => svc); if (svc is ISourceRun runner) { var thread = new Thread(new ThreadStart(runner.run)); thread.Name = $"Service Thread"; thread.Start(); log.info($"{svc} is starting a thread to run.", "svc"); } else { log.info($"{svc} is NOT starting a thread to run.", "svc"); } } } }
public void start(TSource svc) { if (svc != null) { log.info($"Starting service {svc}"); Imm.AddOrUpdate(ref m_services, svc.id, svc, (k, v) => svc); if (svc is ISourceRun runner) { var thread = new Thread(new ThreadStart(runner.run)); thread.Name = $"Service Thread"; thread.Start(); log.info($"{svc} is starting a thread to run.", "svc"); } else { log.info($"{svc} is NOT starting a thread to run.", "svc"); } } }