[Insight-developers] Using kwsys/Process.h functions

Brad King brad.king at kitware.com
Fri May 4 17:05:02 EDT 2007


kent williams wrote:
> I see what you intend here.  I was confused by the concept of
> kwsysProcessDetach -- I thought that you had to set detach in order for it
> to run concurrently.  Is it the case that the processes started are always
> running concurrently, but if they're detached it drops all attachment to the
> process?
> 
> What I want to do is pretty simple: If I'm on a multiprocessor machine,
> start more than one instance of an external program in parallel.

The processes always run concurrently.  Just use more than one instance
of kwsysProcess to start more than one child.  Unfortunately I've not
had time to implement features to make running more than once process at
a time nice (it was written for ctest which runs only one test at a
time).  In order to wait for them to exit you have to poll them
alternately using the kwsysProcess_WaitForExit function with the second
argument providing a per-call wait timeout.  Without a timeout on the
WaitForExit call your parent process will block in the call until its
child exits, or the process level timeout set with kwsysProcess_Timeout
expires and the child is killed.

-Brad


More information about the Insight-developers mailing list