summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2003-02-27 19:13:48 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2003-02-27 19:13:48 +0000
commit27b50d1f4df34995aaa0f0638ed91788ae805f44 (patch)
treef69732fc7930cfc5ebef670569625edd237b4e83 /threadproc
parentdf9eb9c6679d284355e5d90c1fdafad5bb60030b (diff)
downloadlibapr-27b50d1f4df34995aaa0f0638ed91788ae805f44.tar.gz
As near as I can tell, Win32 will now correspond to Unix in terms of the
availability and lifetime of the hproc process handle. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64388 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/win32/proc.c7
-rw-r--r--threadproc/win32/signals.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c
index 9f13d6e7a..ed52f314b 100644
--- a/threadproc/win32/proc.c
+++ b/threadproc/win32/proc.c
@@ -699,7 +699,10 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
apr_pool_t *p)
{
/* Unix does apr_proc_wait(proc(-1), exitcode, exitwhy, waithow)
- * but Win32's apr_proc_wait won't work that way.
+ * but Win32's apr_proc_wait won't work that way. We can either
+ * register all APR created processes in some sort of AsyncWait
+ * thread, or simply walk from the global process pool for all
+ * apr_pool_note_subprocess()es registered with APR.
*/
return APR_ENOTIMPL;
}
@@ -735,6 +738,8 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
*exitcode = stat;
if (exitwhy)
*exitwhy = why_from_exit_code(stat);
+ CloseHandle(proc->hproc);
+ proc->hproc = NULL;
return APR_CHILD_DONE;
}
}
diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c
index b10ccc43d..e83e009fb 100644
--- a/threadproc/win32/signals.c
+++ b/threadproc/win32/signals.c
@@ -65,15 +65,20 @@
#include <sys/wait.h>
#endif
-/* Windows only really support killing process, but that will do for now. */
+/* Windows only really support killing process, but that will do for now.
+ *
+ * ### Actually, closing the input handle to the proc should also do fine
+ * for most console apps. This definately needs improvement...
+ */
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal)
{
if (proc->hproc != NULL) {
if (TerminateProcess(proc->hproc, signal) == 0) {
return apr_get_os_error();
}
- CloseHandle(proc->hproc);
- proc->hproc = NULL;
+ /* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around,
+ * so we will leave hproc alone until the app calls apr_proc_wait().
+ */
return APR_SUCCESS;
}
return APR_EPROC_UNKNOWN;
@@ -82,6 +87,7 @@ APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal)
void apr_signal_init(apr_pool_t *pglobal)
{
}
+
const char *apr_signal_description_get(int signum)
{
return "unknown signal (not supported)";