apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Tutt" <rassi...@lyra.org>
Subject RE: [PATCH] WIN32 Optimistic apr_proc_kill
Date Fri, 15 Feb 2002 22:44:00 GMT
This isn't a nicer way to kill child processes. While DLL cleanup tasks
might happen you have no idea whether or not the app you're trying to
terminate is in a state useful to try this out. The user still might see
a Win32 generated A/V dialog (or worse) when you do try this trick.

How about this for an alternate suggestion:
1) Posting a WM_CLOSE to its window(s) (if any).
  You can do this by using a combination of EnumWindows, and
GetWindowThreadProcessID.

2) If you don't find any windows try calling GenerateConsoleCtrlEvent
with CTRL_CLOSE_EVENT, and see if that causes the process to terminate.

3) If the above options time out then you might as well call
TerminateProcess() because injecting a call to ExitProcess() isn't going
to guarantee you anything anyway. 

All of this brings a timeout into the picture. Do you really want that?

Bill
--
Bunnies aren't just cute like everybody supposes.
They got their hoppy legs and twitchy little noses.
And what's with all the carrots, 
What do they need such good eyesight for anyway?



Mime
View raw message