public static void InvioDati(DataSender datasender) { while (true) { datasender.Send(); } }
static void Main(string[] args) { List <String> idMezzi = new AppSettingsReader().GetValue("idMezzi", typeof(string)).ToString().Split(',').ToList(); List <Thread> lstThread = new List <Thread>(); foreach (string id in idMezzi) { DataReader dr = new DataReader(); Thread t = new Thread(() => Generadati(dr, id)); t.Name = "id" + id; t.Start(); lstThread.Add(t); } DataSender ds = new DataSender(); Thread invio = new Thread(() => InvioDati(ds)); invio.Start(); //Console.WriteLine("Sensori in funzione"); }