QueueCompareProcessThread() 异常消息:值不在预期范围内。跟踪:在 System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32 毫秒Timeout, Boolean exitContext) 在 System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32 millisecondsTimeout, Boolean exitContext) 在 System.Threading. WaitHandle.WaitAny(WaitHandle[] waitHandles)
当我在线程中使用该WaitAny
方法时,出现上述异常。WaitHandle
请帮我解决问题。这是我的部分代码:
public void QueueCompareProcessThread(QueueProcesses Qp)
{
try
{
WaitHandle[] pHandles = Qp.GetRunningProcessesHandles();
WaitHandle.WaitAny(pHandles);
Qp.RemoveExitedProcess(); // clearing the process list
// strange behavior is while clearing the process list i'm getting the exception in the thread Waitany method
// Does Waitany method still working after it returns?
}
catch (Exception e)
{
utils.Log("QProc Exception at QueueCompareProcessThread() Message:" + e.Message + " Trace:" + e.StackTrace);
}
}
谁能提供一些关于 WaitAny 方法的想法并帮助我解决问题?