我的情况是:循环和线程并行工作..我想停止循环的执行,直到线程完成其功能,当线程状态停止时,那时我想进一步执行循环..
for (int pp = 0; pp < LstIop.Count; pp++)
{
oCntrlImageDisplay = new CntrlImageDisplay();
oCntrlImageEdit = new CntrlImageEdit();
axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
int pages = ConvertFileIntoBinary(LstIop[pp].Input, oCntrlImageEdit);
oCntrlImageDisplay.ImgDisplay.Image = LstIop[pp].Output;
oCntrlImageDisplay.ImgEditor.Image = oCntrlImageDisplay.ImgDisplay.Image;
if (t1 == null || t1.ThreadState.ToString() == "Stopped")
{
t1 = new Thread(() => convert(pages, LstIop[pp].Input, LstIop[pp].Output, stIop[pp].Temp));
t1.SetApartmentState(ApartmentState.STA);
t1.IsBackground = true;
CheckForIllegalCrossThreadCalls = false;
t1.Start();
}
}