Asynchronous Process.WaitForExit()?



Is there any way to do an asynchronous wait for a process to exit? My
application needs to monitor when processes it launched have completed and
take further action. However, the app can launch processes essentially
randomly (with respect to any other launched processes and/or their
completion). The current implementation has to create a thread per process
simply to wait for that process to exit and fire an event back into the main
thread. It would be a whole lot simpler if there was a BeginWaitForExit()
method on Process to allow my app to be notified asynchronously as each
process terminated.

Is there any way to emulate that kind of functionality? So far, I'm missing
it.

In fact, it's not clear to me that you can asynchronously wait on any
signalable Win32 object in the elegant generalized fashion of Win32.

Am I overlooking some functionality that's available in .NET?

BTW, it's fine if it'a .NET 2.0 only thing.

Thanks,
Doug Harber


.



Relevant Pages

  • Re: Return Value from Background System Call
    ... What am I trying to do: I am trying to launch a browser from a perl/Tk ... fact that 0 does not indicate failure does not necessarily imply that it ... and that the launched app returned a 0 exit status. ... The meaning of a 0 exit status has to be interpreted in the context of the ...
    (comp.lang.perl.misc)
  • Re: Threads help
    ... The pattern goes something like this: ... protected AutoResetEvent thev = new AutoResetEvent; ... Time to exit the thread... ... launch a thread that do something with a interval of 30 seconds at least, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Blocked threads vs Thread.Interrupt
    ... > launch a thread I usually have it run in a loop that blocks waiting on ... > your app can exit even if the thread is still running. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: converting assembler from one cpu to another ?
    ... launch os then to launch a 6502 based application (from an atari or ... commodore machine) a VM would launch and then exit when the program is ... You'll need a lot more than just the CPU emulation - very often ... hardware etc) that you would also need to emulate. ...
    (alt.lang.asm)
  • Re: Word 2000 Launched from ACT! 2005
    ... the functionality of Word is NOT limited when launched from another ... ACT 6 works with Word 2002 and Word ... > launch Word from with ACT!, generate documents, and then print, email, ... They also claim that, as this is a limitation of Word, they have ...
    (microsoft.public.word.vba.general)