private void timer1_Tick(object sender, EventArgs e)
{ Server.ServerAll pp = new ServerAll();
if (op == 1)//op为静态变量,初始为0
{
if (wwyy.ThreadState == System.Threading.ThreadState.Suspended)
--------一次过后变为stoppped,这时内存会自动清理资源么????
{ }
}
dataGridView1.DataSource = pp.SelectAllWait().Tables[0];
dataGridView2.DataSource = pp.SelectAllWait().Tables[1];
//dataGridView计算行会多加一行
int p = pp.SelectAll().Tables[0].Rows.Count;
int q = pp.SelectAll().Tables[1].Rows.Count;
//&& (wwyy.ThreadState == System.Threading.ThreadState.Unstarted||)
if (p != 0 )
{
wwyy = new Thread(new ThreadStart(SendData));
wwyy.Start();
}
if (q != 0)
{
wy = new Thread(new ThreadStart(SendComment));
wy.Start();
}
op = 1;
timer1.Interval = 1000 * 60;
}急急急急急急急急!!谢谢
{ Server.ServerAll pp = new ServerAll();
if (op == 1)//op为静态变量,初始为0
{
if (wwyy.ThreadState == System.Threading.ThreadState.Suspended)
--------一次过后变为stoppped,这时内存会自动清理资源么????
{ }
}
dataGridView1.DataSource = pp.SelectAllWait().Tables[0];
dataGridView2.DataSource = pp.SelectAllWait().Tables[1];
//dataGridView计算行会多加一行
int p = pp.SelectAll().Tables[0].Rows.Count;
int q = pp.SelectAll().Tables[1].Rows.Count;
//&& (wwyy.ThreadState == System.Threading.ThreadState.Unstarted||)
if (p != 0 )
{
wwyy = new Thread(new ThreadStart(SendData));
wwyy.Start();
}
if (q != 0)
{
wy = new Thread(new ThreadStart(SendComment));
wy.Start();
}
op = 1;
timer1.Interval = 1000 * 60;
}急急急急急急急急!!谢谢
Thread wy,wwyy;那这样每次wwyy = new Thread(new ThreadStart(SendData));一下那是在不断的耗内存资源对么?最后电脑就挂掉了?
回收线程资源
gc的责任