Hi I am trying to do the following: I have a process which can take parameters (digits) and return the sum of these numbers
Process P = Process.Start(sPhysicalFilePath, Param); int result = P.ExitCode;
I get the return value from "ExitCode" the problem is: the program sometimes finishes his work before the process so when the program reaches this line
int result = P.ExitCode;
I got an exception .. my question is how to wait this process until it finishes its work sorry I forget to say that's I am working with C# language
To get the return value of a function passed to Python multiprocessing. Process, we can use the manager. dict method to create a shared variable. to create a Process object with the target set to the worker function that runs for each process.
In this example, at first we import the Process class then initiate Process object with the display() function. Then process is started with start() method and then complete the process with the join() method. We can also pass arguments to the function using args keyword.
use:
Process P = Process.Start(sPhysicalFilePath, Param); P.WaitForExit(); int result = P.ExitCode;
from MSDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With