xtd 0.2.0
Loading...
Searching...
No Matches

◆ exited

exit_event xtd::diagnostics::process::exited

Occurs when a process exits.

Remarks
The exited event indicates that the associated process exited. This occurrence means either that the process terminated (aborted) or successfully closed. This event can occur only if the value of the EnableRaisingEvents property is true.
There are two ways of being notified when the associated process exits: synchronously and asynchronously. Synchronous notification means calling the xtd::diagnostics::process::wait_for_exit method to block the current thread until the process exits. Asynchronous notification uses the xtd::diagnostics::process::exited event, which allows the calling thread to continue execution in the meantime. In the latter case, xtd::diagnostics::process::enable_raising_events must be set to true for the calling application to receive the xtd::diagnostics::process::exited event.
When the operating system shuts down a process, it notifies all other processes that have registered handlers for the xtd::diagnostics::process::exited event. At this time, the handle of the process that just exited can be used to access some properties such as xtd::diagnostics::process::exit_time and xtd::diagnostics::process::has_exited that the operating system maintains until it releases that handle completely.
Note
Even if you have a handle to an exited process, you cannot call xtd::diagnostics::process::start again to reconnect to the same process. Calling xtd::diagnostics::process::start automatically releases the associated process and connects to a process with the same file but an entirely new xtd::diagnostics::process::handle.