c# - start processes with a delay -
how can start 5 different processes, each own delay without holding other ones while waiting delay finish? can not use async or await
foreach(string process1 in _processlist) { // random delay process.start(process1); }
you start every process different thread.
foreach (string process1 in _processlist) { thread t = new thread(() => { thread.sleep(/*random number*/ 5); process.start(process1); }); t.start(); }
that way each process have random timer before start , no process delayed start of other process.
if starting thread totaly impossible in situation, suggest wrapping process .bat , in batch file add sleep delay way process called in time , sleep delay respected.
Comments
Post a Comment