我正在为一个网络执行一个程序,在该网络中我有一定数量的任务在循环中执行,它工作正常,但是当由于网络问题而出现任何缺陷时,它会卡在任何任务中。所以我想创建一个线程,它在控制进入循环时开始,经过一段时间的延迟,它会自行终止并继续进程。
例如-
for ( /*itearting condition */)
{
//thread start with specified time.
task1;
task2;
task3;
//if any execution delay occur then wait till specified time and then
//continue.
}
请给我一些关于这个的线索,一个片段可以帮助我很多,因为我需要尽快修复它。