中止长跑法

时间:2013-01-16 20:09:45

标签: .net abort

这是一个循环

偶尔aPdf.Save需要几分钟。

我想设置60秒的时间限制 如果需要更长的时间,只需设置succUpdate = false;并继续

try
{
    aPdf = new Aspose.Pdf.Document(docPathIn);
    // aPdf.Save will just hang some times and not throw an exception
    // if is runs more than 60 seconds I would like to give up and move to the next document
    aPdf.Save(MyDirOut + nativeXPSnew, Aspose.Pdf.SaveFormat.Xps);
    succUpdate = true;
}
catch (Exception Ex)
{
    Debug.WriteLine(Ex.Message);
    succUpdate = true;
}
finally
{
    aPdf = null;
}

0 个答案:

没有答案