1. improved wxKill() implementation for Win32

2. added wxKillError output parameter to wxKill
3. added wxProcess::Kill() and Exists()
4. documented all the new stuff
5. updated the sample to show it


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-06-16 00:59:07 +00:00
parent b3d008dbd5
commit 50567b69d6
9 changed files with 545 additions and 67 deletions

View File

@@ -1755,13 +1755,56 @@ this default behaviour.
\membersection{::wxKill}\label{wxkill}
\func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig}}
\func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}}
Under Unix (the only supported platform), equivalent to the Unix kill function.
Returns 0 on success, -1 on failure.
Equivalent to the Unix kill function: send the given signal {\it sig} to the
process with PID {\it pid}. The valud signal values are
Tip: sending a signal of 0 to a process returns -1 if the process does not exist.
It does not raise a signal in the receiving process.
\begin{verbatim}
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGEMT,
wxSIGFPE,
wxSIGKILL, // forcefully kill, dangerous!
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM // terminate the process gently
};
\end{verbatim}
{\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning
under both Unix and Windows but all the other signals are equivalent to
{\tt wxSIGTERM} under Windows.
Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will
be filled with an element of {\tt wxKillError} enum:
\begin{verbatim}
enum wxKillError
{
wxKILL_OK, // no error
wxKILL_BAD_SIGNAL, // no such signal
wxKILL_ACCESS_DENIED, // permission denied
wxKILL_NO_PROCESS, // no such process
wxKILL_ERROR // another, unspecified error
};
\end{verbatim}
\wxheading{See also}
\helpref{wxProcess::Kill}{wxprocesskill},\rtfsp
\helpref{wxProcess::Exists}{wxprocessexists},\rtfsp
\helpref{Exec sample}{sampleexex}
\wxheading{Include files}

View File

@@ -108,6 +108,68 @@ It returns an output stream correspoding to the input stream of the subprocess.
If it is NULL, you have not turned on the redirection.
See \helpref{wxProcess::Redirect}{wxprocessredirect}.
\membersection{wxProcess::Kill}\label{wxprocesskill}
\func{static wxKillError}{Kill}{\param{int}{ pid}, \param{wxSignal}{ signal = wxSIGNONE}}
Send the specified signal to the given process. Possible signal values are:
\begin{verbatim}
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGEMT,
wxSIGFPE,
wxSIGKILL, // forcefully kill, dangerous!
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM // terminate the process gently
};
\end{verbatim}
{\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning
under both Unix and Windows but all the other signals are equivalent to
{\tt wxSIGTERM} under Windows.
Returns the element of {\tt wxKillError} enum:
\begin{verbatim}
enum wxKillError
{
wxKILL_OK, // no error
wxKILL_BAD_SIGNAL, // no such signal
wxKILL_ACCESS_DENIED, // permission denied
wxKILL_NO_PROCESS, // no such process
wxKILL_ERROR // another, unspecified error
};
\end{verbatim}
\wxheading{See also}
\helpref{wxProcess::Exists}{wxprocessexists},\rtfsp
\helpref{wxKill}{wxkill},\rtfsp
\helpref{Exec sample}{sampleexex}
\membersection{wxProcess::Kill}\label{wxprocessexists}
\func{static bool}{Exists}{\param{int}{ pid}}
Returns {\tt TRUE} if the given process exists in the system.
\wxheading{See also}
\helpref{wxProcess::Kill}{wxprocesskill},\rtfsp
\helpref{Exec sample}{sampleexex}
\membersection{wxProcess::OnTerminate}\label{wxprocessonterminate}
\constfunc{void}{OnTerminate}{\param{int}{ pid}, \param{int}{ status}}

View File

@@ -162,7 +162,9 @@ external programs and the sample shows how to do this synchronously (waiting
until the program terminates) or asynchronously (notification will come later).
It also shows how to capture the output of the child process in both
synchronous and asynchronous cases.
synchronous and asynchronous cases and how to kill the processes with
\helpref{wxProcess::Kill}{wxprocesskill} and test for their existence with
\helpref{wxProcess::Exists}{wxprocessexists}.
\subsection{Scroll subwindow sample}\label{samplescrollsub}