[lldb-dev] Process spawning and shutdown
Greg Clayton
gclayton at apple.com
Mon Sep 22 11:15:42 PDT 2014
So you can get the exit status of a process using
BOOL WINAPI GetExitCodeProcess(_In_ HANDLE hProcess, _Out_ LPDWORD lpExitCode);
Is there a way to wait for the process to exit without polling? Or do you have to keep calling GetExitCodeProcess() until STILL_ACTIVE is not returned? I am guessing you can wait on the hProcess handle somehow?
Anyway, it seems like we want the following when launching processes:
1 - a way to wait for a process to finish with an optional timeout (which defaults to infinite)
2 - a way to say, no need to wait for the process to finish
For 1, we do what we are currently doing. The process monitor callback for windows will need to wait for the process to exit, then call GetExitCodeProcess() when done and return the value. On unix machines, we will reap the process and return the exit status.
For 2, windows doesn't need to do anything, but we still need to reap the process on unix to avoid zombies.
Not sure if I missed any scenarios?
Greg
> On Sep 22, 2014, at 9:33 AM, Zachary Turner <zturner at google.com> wrote:
>
> Yes, but closing the handle is semantically a different operation than reaping a process. You can close a handle to a process while the process is still running and it doesn't affect anything except that it frees up space in your process's handle table. You can also not close a handle, and if the process exits nothing bad will come of it. So closing the handle is more tied to the lifetime of the instantiated HostProcess , and independent of the actual process running on ths system.
>
> On Sun, Sep 21, 2014 at 11:40 PM, Matthew Gardiner <mg11 at csr.com> wrote:
> On Wed, 2014-09-17 at 00:27 -0700, Zachary Turner wrote:
>
> > I know Join isn't really the right word, but there's no concept of
> > reaping a process on Windows.
>
> However, on Windows, isn't there still a requirement to CloseHandle that
> handles returned by CreateProcess?
>
> Matt
>
>
>
>
>
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
> New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list