asp.net后台多線程的使用


======== 調用無參數的方法 ============
            //創建線程對象 傳入 委托線程執行的方法
            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();


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM