我有 4 个任务来比较两个 PDF 的字体系列和字体样式。如果我连续执行这 4 个任务,则需要很长时间。如果我并行运行它们,结果文本将不正确。
public void Compare_Click(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(firstpdffont_compare));
ThreadPool.QueueUserWorkItem(new WaitCallback(secondpdffont_compare));
ThreadPool.QueueUserWorkItem(new WaitCallback(firstpdf_fontstyle_compare));
ThreadPool.QueueUserWorkItem(new WaitCallback(secondpdf_fontstyle_compare));
//----after this append function which is not in thread
Appendresult();
}
我怎样才能成功地并行化这些任务?