I have a timer executing a loop executing a series of threads. Each thread simply polls a serial device (on unique ports) and writes the data to a MySQL Database for pickup by a web application.
我只想看一看 lo子里的最后一线。
这里是我的时间<代码>Interval方法。
static void glob_timer_Elapsed(object sender, ElapsedEventArgs e)
{
foreach (object[] row in user_ids)
{
Console.WriteLine(row[0].ToString() + ":" + row[1].ToString());
ThreadStart starter = delegate { Functions.UpdateFor(row[0].ToString(), row[1].ToString()); };
new Thread(starter).Start();
}
}
用户_ids is a List<object[]>
载有来自询问的浏览量;因此,row[0]
=user ID<>em>,row }
=Com Portony/em>
在职能<代码>上:
public static void UpdateFor(string uid, string com_name)
{
try
{
Console.WriteLine("[" + uid + "]- " + DateTime.Now.ToString() + " : " + "Begin read transmission.");
When this is run, in the console I see
1:COM1
2:COM2
[2]-{DateTime} : Begin read transmission
为什么我看不到《<代码>UpdateFor for uid 1.
注:我还核实了从COM1中拟写给非行的数据。