Bry*_*sby 1 c# asynchronous process threadpool
我有一个处理文件传输的应用程序.在某些情况下,我需要启动一些处理文件的前/后处理可执行文件.
所以事件的顺序(简而言之)就像这样:
基本上,我不关心在传输发生后后进程可执行文件运行多长时间.因此,如果我从一个然后返回池中的线程启动进程,我是否应该预料到任何问题?
//后期过程
Process process = null;
ProcessStartInfo psi = new ProcessStartInfo(executable, args);
psi.UseShellExecute = true;
try
{
process = Process.Start(psi);
//The pre-process simply calls Process.WaitForExit(timeout value)
launched = true;
}
catch (InvalidOperationException) { }
catch (ArgumentException) { }
catch (System.ComponentModel.Win32Exception) { }
catch (System.IO.FileNotFoundException) { }
Run Code Online (Sandbox Code Playgroud)