多線程開啓,不帶參數、帶參數

1、不帶參數

            Thread thdShowTestLog = new Thread((ThreadStart)ThreadShowLogFun);
            thdShowTestLog.IsBackground = true;
            thdShowTestLog.SetApartmentState(ApartmentState.STA);
            thdShowTestLog.Start();

       private void ThreadShowLogFun()
        {
            //代碼邏輯
        }

 

2、帶參數

               Thread readMes = new Thread(() => ReadMesTestData(false, 0));
                readMes.IsBackground = true;
                readMes.SetApartmentState(ApartmentState.STA);
                readMes.Start();

 

private void ReadMesTestData(bool ManualUpdateMes , int manualManageId )
 {

          //代碼邏輯

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章