c#中invoke和beginvoke的區別

thread th=new thread(()=>{

control.invoke(new Action(()=>{

thread.sleep(5000);

}));

//dosometings

});

th.start();

這個線程裏的dosometings將在5000毫秒後執行,invoke是在異步線程阻塞的,可以阻塞另一個線程,而begininvoke則相反是非阻塞異步執行

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