process-exit

How to Exit a Process (.exec()) if the External Program hangs

吃可爱长大的小学妹 提交于 2019-12-10 19:17:44
问题 Let me explain my software. What my software simply does is that it creates 10 threads and assigns a number of tasks to each thread. Each thread then creates a Runtime Process that will start a cmd batch file which in turn will start a program that will telnet to a device (I have about 200 of them) to poll its configuration. Here is the code for my process creation: Process p1 = java.lang.Runtime.getRuntime().exec("cmd /c start /b /wait " + batchFile); int returnVal = p1.waitFor(); batchFile

When will AppDomain.ProcessExit not get called?

自闭症网瘾萝莉.ら 提交于 2019-12-04 04:46:32
问题 Enabling line //1 below will make the program crash without "proc exit" being printed, but in case of line //2 , "proc exit" will be printed. "unhandled" btw gets printed in both cases. Why the difference, and what are the rules in general? Obviously killing an app using e.g. the task manager will prevent "proc exit" from being printed, but other than that, what are the cases it doesn't get printed? static void Main(string[] args) { Thread.GetDomain().UnhandledException += (sender, eventArgs)