3 using System
.Diagnostics
;
4 using System
.Threading
;
5 using System
.Threading
.Tasks
;
11 for (int i
= 0; i
< 1000; ++i
) {
12 ProcessStartInfo psi
= new ProcessStartInfo () {
15 RedirectStandardOutput
= true,
16 UseShellExecute
= false
19 Process p
= Process
.Start (psi
);
21 ManualResetEvent mre
= new ManualResetEvent (false);
23 Task t
= Task
.Run (() => {
25 p
.BeginOutputReadLine ();
26 if (!p
.WaitForExit (10000))
30 if (!mre
.WaitOne (10000))
32 if (!p
.WaitForExit (10000))