1. 程式人生 > >asp.net後臺多線程的使用

asp.net後臺多線程的使用

next .net 結束 bind ack sta pki mes system

======== 調用無參數的方法 ============
//創建線程對象 傳入 委托線程執行的方法
Thread ts = new Thread(CountTimes);
//啟動線程 執行方法
ts.Start();
//將線程設置為後臺線程(當所有的前臺線程結束後,後臺線程會自動退出)
//ts.IsBackground = true;//將該線程設置為後臺線程


============ 調用有參數的方法 ==================
Thread tr = new Thread(() =>
{
RptBind("PKID desc");
});

//將線程設置為後臺線程(當所有的前臺線程結束後,後臺線程會自動退出)
//將該線程設置為後臺線程
tr.IsBackground = true;
tr.Start();

System.Threading.Thread t = new System.Threading.Thread(() =>
{
fssong(id, name, po_bu, next_nun);
});
t.IsBackground = true;
t.Start();

asp.net後臺多線程的使用